Replies: 2 comments 1 reply
-
|
You can loop through an entry’s other sites via <ul>
<li><a href="{{ element.url }}">{{ element.site.name }}</a></li>
{% for localized in element.getLocalized() %}
<li><a href="{{ localized.url }}">{{ localized.site.name }}</a></li>
{% endfor %}
</ul>Does that help? If not, I’m not totally following what you’re trying to do. I guess maybe by “siteswitcher” you’re referring to this plugin, but that is a third party plugin that I’m not familiar with. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the tip, that's good to know, it will come in handy. I found out the site switcher plugin (it is the one you mentioned) actually does a better job than I realized. Over time, I had been building so many lines of code around it, that all it took, was go back to the naked plugin with a fix for a few exceptions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In a template, I want to search if there is a section with a part of the slug as its uri, and then get the uri of the other, inactive language, so the sections can be
the site-switcher plugin translates categories and entries, but not sections?!
I have a beast of a macro now that may just be overkill, and it has some sections hard coded in there, but it would be much better to be able to look up the sections other language uri's. Any help would be greatly appreciated.
I am getting told that I can't look up sections by it's URI and that I should loop over all the sections, for example:
and then look up the URI of that section in the other languages
Am I missing something? Is siteswitcher not taking care of this? The issue seems to be when I use a single section, for example /projects and then use a routing for /projects/{slug} to the same template to filter out certain categories
I am using Craft 5.
Beta Was this translation helpful? Give feedback.
All reactions