1

For the robot.txt file, I want to get every URI from the entries for every language. Right now it just gets the URI from one language.

{% set crawledEntries = craft.entries({
    relatedTo: { sourceElement: crawlSites, field: "entryCrawler" },
    order: "sortOrder"
}) %}

{% for entry in crawledEntries %}
    Disallow: /{{ entry.uri }}
{% endfor %}

This now loops just through one locale.

1

Got it...

{% set crawledEntries = craft.entries({
    relatedTo: { sourceElement: crawlSites, field: "entryCrawler" },
    order: "sortOrder"
}) %}

{% set otherLocales = craft.i18n.getSiteLocaleIds()|without(craft.locale) %}

{% for entry in crawledEntries %}
    Disallow: /{{ entry.uri }}
    {% for locale in otherLocales %}
        {% set entryL = craft.entries.id(entry.id).locale(locale).first() %}

        {% if entryL %}
            Disallow: /{{locale}}/{{ entryL.uri }}
        {% endif %}
    {% endfor %}
{% endfor %}
| improve this answer | |

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.