Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Luis Pedro 28 posts 149 karma points
    Aug 14, 2019 @ 11:44
    Luis Pedro

    Getting list of page variants to display other language options, per page

    Hey all,

    How can i get the number and list of page variants I have for a particular page , so that I can display other language options (in the top menu or body), considering that having each page in multiple languages is optional.

    So, in a page for DK, I want to show that that page has a translation to EN (automatically the other way around will work as well, same page, EN to DK) and in another page, I only show the DK version, because it was not yet translated and published into EN (or any other language).


  • Shaishav Karnani from 345 posts 1621 karma points
    Aug 14, 2019 @ 13:21
    Shaishav Karnani from


    We can use below code to fetch Multi Languages:-

    @foreach (var (culture, infos) in Model.Cultures)
        <a href="@Model.GetUrl(culture)">@culture @infos.Name</a>

    However, you need to ensure that domains are already setup as per below screenshot for them to work. enter image description here

    Further I would suggest to add Fallback language to provide better content flexibility.

    @Model.Value("pageTitle", "fr", fallback: Fallback.ToLanguage)

    This link is useful.

    Hope this helps you.

  • Poornima Nayar 90 posts 208 karma points MVP c-trib
    Aug 21, 2019 @ 09:31
    Poornima Nayar

    Hi Luis,

    This is what I did. I need to show a shore site name for each culture I have.

    @foreach (var (culture, infos) in Model.Cultures)
            <a href="@(Model.Url(culture))" class="active">@Model.AncestorOrSelf(1).Value("siteName", culture)</a>
Please Sign in or register to post replies

Write your reply to: