1

I am trying to build a sitemap and need to loop through all entries in Craft in order to do this.

However, I am building a multi language site which has entries that can be enabled in a single locale but not in others. Because my default language (English) doesn't have a language code in it's site url (i.e. mysite.com is the English index and mysite.com/ja is the Japanese index), the sitemap template I am using automatically assumes the current locale to be English and any entry that is not enabled in English (but is enabled in another locale) does not get included in the sitemap loop.

Is there any way I can still include entries that are not enabled in the current locale (English) but are enabled in an alternate locale? Or is there some better way I should be doing this?

1

Just add the locale criteria to your entries call and specify the locale(s) you need to query.

{% set items = craft.entries({
    section: 'sectionHandle',
    limit: null,
    locale:"es_us"
}) %}

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.