How to retrieve the data based on different language if I use range?

Here’s my code:

{{ range first 6 (where .Sites.First.RegularPages "Section" "views")}}
            <div class="view-item grid-item">
                <div class="img">
                    <a href="{{ .Permalink }}" data-href="{{ .Params.general_information.image }}"><img src="{{ .Params.general_information.image }}" alt="{{ .Params.title }}|{{ .Params.general_information.slogan }}"></a>
                <div class="text">
                    <h3 class="text-{{ .Params.general_information.color }} f-serif"><a href="{{ .Permalink }}">{{ .Params.title }}</a></h3>
                    <p>{{ .Params.general_information.excerpt }}</p>
            {{ end }}

But when I changed to either /en or original site, it will only retrieve the same language.

My multi-language content were all differs by filename. Such as:, and

I don’t think there is a built in method to retrieve all pages for all languages. What you probably have to do is to range through site.Languages and retrieve all pages from each language and merge those collections, then sort and range through that collection.

Ah, I see.

Do you mind to share me a sample on how to replicate this? I would like it to show only one language per site.

I was able to resolve it using the following:

{{ range first 6 (where .Site.RegularPages "Section" "works")}} instead of {{ range first 6 (where .Sites.First.RegularPages "Section" "works")}}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.