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:
-
Navigate to the Fragment editing page by clicking your Fragment’s Actions
→ Edit button.
-
Specify the image by using this syntax:
[resources:IMAGE_NAME]
. For example, you could include an imagebuilding.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>
-
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.
Great! You’ve successfully referenced a default resource from your Fragment Collection!