Copied to clipboard

Flag this post as spam?

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


  • apload-gmbh 33 posts 93 karma points
    Jan 13, 2023 @ 09:55
    apload-gmbh
    0

    Links with razor in partial view according language

    Dear community

    We have a multi-language customer website, and we like to set directly in the partial view of the footer an internal link to a subpage.

    Is there an easy solution to set a link that will work in every language, respectively goes to the language specific page, like

    DE: my.domain.com/kontakt EN: my.domain.com/en/contact FR: my.domain.com/fr/contact

    Or do we have to set that together with an extra helper?

    Thanks for any suggetions.

    Jan

  • Dhanesh Kumar MJ 158 posts 511 karma points c-trib
    Jan 13, 2023 @ 15:19
    Dhanesh Kumar MJ
    0

    Hi,

    You can get the specific content url based on culture, use a default culture code and you can use it like below.

    var defaultCulture= "culture code here";
    var defaultContent= _publishedContentQuery.Content().Url(culture:defaultCulture);
    

    _publishedContentQuery is IPublishedContentQuery

Please Sign in or register to post replies

Write your reply to:

Draft