I am using SEOmatic helper class to get localizedUrls which is making life much easier! I would like to only display the localizedurl if the current entry is enable on that site. Below is what I have, has anyone successful done this for craft 3?
{% set currentSite = craft.app.sites.currentSite %}
{% set currentSiteLanguage = currentSite['language'] %}
{% set localizedUrlsArray = seomatic.helper.getLocalizedUrls() %}
{% for localizedUrls in localizedUrlsArray %}
{% if currentSiteLanguage != localizedUrls['language'] %}
{% if entry is defined %}
{% if entry.enabledForSite %}
<a href="{{ localizedUrls['url'] }}"> {{ localizedUrls['language'] }}</a>
{% endif %}
{% else %}
<a href="{{ localizedUrls['url'] }}"> {{ localizedUrls['language'] }}</a>
{% endif %}
{% endif %}
{% endfor %}
{{ dump(localizedUrlsArray) }}
to look at the data that's being returned to you fromseomatic.helper.getLocalizedUrls()
to make sure it is what you think it is. Also you don't mention what is wrong or not working as expected with the code you've shown?.status
to make sure it'slive
then?