Cannot access Globals set variables from template #9368
-
Hi all, I created from CP a new Global Set called Branding, and within its Blueprint an Asset Field pointing to my /images container in /public/images, which has URL '/images' in config/filesystems:
This is the resulting branding.yml
In my template, if I point manually to the image it works: But if I try getting the Global variable it prints out nothing (as in src=""): I also trying clearing the stache, what am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey 👋 It looks like you're storing the Otherwise, the Assets field would allow you to select multiple assets for the logo and you'd have to do this to make it work: {{ branding:site_logo }}
<img src="{{ url }}" />
{{ /branding:site_logo }} You can see more information about Templating w/ the Assets Fieldtype here. |
Beta Was this translation helpful? Give feedback.
Hey 👋
It looks like you're storing the
site_logo
as an array of assets, rather than just a single asset. Unless you have multiple logos, you probably want to set "Max Items" to 1 in your asset field's config so the syntax you're using works.Otherwise, the Assets field would allow you to select multiple assets for the logo and you'd have to do this to make it work:
You can see more information about Templating w/ the Assets Fieldtype here.