How to use global assets and page attachments?

You can access Assets and page attachmets from page/part/snippet/layout code using specific tags thumbnail_url, attachment_url, thumbnail_tag, image_tag.

{{ ':image.png' | thumbnail_url: 'size:100', 'absolute:true' }} <!-- global assets -->

{{ 'page1:image.png' | attachment_url: 'absolute:true' }} <!--  page1 file url -->

{{ 'image.png' | thumbnail_tag: 'size:100', 'title:A title', 'width:100px', 'height:200px'  }} <!--  current page file -->

{{ page.attachments['filename.png'].url  }} <!--  current page file -->

{{ pages['main'].attachments['filename.png'].image?  }} <!--  "main" page file -->
Was this article helpful? Yes  No
414 from 457 found this helpful