1

How do I display an asset (PDF) from both site languages on both sites? I would like to offer both German and English versions of a PDF on both the English and German sites.

I now have {{ entry.PDF.url }} and wondered if I can add a .site() direction to the entry query.

1

You could try and fetch the other pdf by creating an entry query for the different language, and getting the pdf from there.

{# if you have only 2 languages: #}
{% set otherLanguage = craft.entries().id(entry.id).siteId(['not', entry.siteId).one() %}
{{ otherLanguage.PDF.url }}


{# if you have more languages (and want all the PDFs: #}
{% set otherLanguages = craft.entries().id(entry.id).siteId(['not', entry.siteId).all() %}
{% for $otherLanguage in $otherLanguages %}
    {{ otherLanguage.PDF.url }}
{% endfor %}
1
  • THanks, that works!!
    – Matthias
    Nov 13 '20 at 11:04

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.