I have craft pro and have one tagGroup called Tags Then I created a Tag field called newsTag like this:
When I add a tag for german, the tag is also created in the database for dutch and english, so when I get a list of used tags like this:
{% set tagsEntries = craft.entries
.section('news')
.limit(null)
.all() %}
{% for atag in craft.tags.relatedTo(tagsEntries) %}
<li {% if tag == atag.title %} class="is-active" {% endif %}><a href="{{ newsEntry.url }}/{{ atag.slug }}">{{ atag.title }}</a></li>
{% endfor %}
Now I get all tags used in all sites. when I use it like this:
{% set tags = craft.tags.relatedTo({
sourceElement: tagsEntries,
sourceLocale: craft.site
}) %}
Then I still get all tags, because when I look at the database the tag for German is also created for Dutch and English:
In the content table:
When I remove the entry for site 1 and 3 (the dutch and english site) the it works, but will be added again on entry save...
Is it somehow possible to only save a tag for one site? That way I can get all the tags only used in that site and not all.
ps, this only happens with tags in entries that are used/enabled for 2 or more sites.
Thanks for the help,
Dimitri