0

I have a {{ siteURL }} tag inside a matrix plain text field. But it does only render as a tag and isn't beeing converted to the actual url.

Accoring to this post one way is to use reference tags.

So I write inside the matrix plain text field: { globalset:siteUrl } and in the template I write:

{% for block in siteDropdown.matrixDropdown %}
   <li>
     <a href="{{ block.cellLink|parseRefs|raw }}">{{ block.cellLinkTitle }}</a>
    </li>
{% endfor %}

But this does nothing but print the tag itself. What am I missing?

2

You'll need to use the global set's element ID as the reference part (second segment) of the reference tag:

{globalset:51:siteUrl}

To find the global set's ID, go to CP -> Settings -> Globals. The URL to the global set will have the ID as the last segment (e.g. http://yoursite.craft.dev/admin/settings/globals/51)

Also, see the this SE thread for a little more info: How can I use a reference tag with a global set using the handle (not the ID)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.