Including Default Resources in Fragments

When creating Page Fragments, you can upload resources (e.g., images, documents, etc.) to your Fragment Collection to make them always available from the Collection, rather than relying on resources uploaded in other areas of your Site (e.g., Documents and Media). For more information on how to include resources in your Fragment Collection from the Page Fragments interface, see Creating Page Fragments.

Once you’ve uploaded your resource to a Fragment Collection, you can specify it in your Fragment:

  1. Navigate to the Fragment editing page by clicking your Fragment’s Actions ActionsEdit button.

  2. Specify the image by using this syntax: [resources:IMAGE_NAME]. For example, you could include an image building.png within an HTML image tag like this:

    <img src="[resources:building.png]">
    

    You can view a full example snippet below:

    <div class="fragment_38314">
        <lfr-editable id="img" type="image">
            <img src="[resources:building.png]">
        </lfr-editable>
    </div>
    
  3. Add any additional HTML, CSS, or JavaScript to your Fragment and then click Publish.

Figure 1: Any Fragment from the Fragment Collection has access to the uploaded resources.

Figure 1: Any Fragment from the Fragment Collection has access to the uploaded resources.

Great! You’ve successfully referenced a default resource from your Fragment Collection!

« Creating a Contributed Fragment CollectionSupporting Custom Content Types in Content and Display Pages »
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています