Copied to clipboard

Flag this post as spam?

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


  • giuseppe 8 posts 61 karma points
    1 week ago
    giuseppe
    0

    Language switcher error on 8.10

    Hi, I used successfully this code snippet to switch languages in a multilanguage site with Umbraco 8.02.

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

    After the upgrade to Umbraco 8.10 I get this error enter image description here Any idea on how to solve it?

  • Luke Hook 32 posts 135 karma points
    1 week ago
    Luke Hook
    102

    I might be wrong, but I think in the recent changes around the IPublishedContent the syntax is now the following

    Model.Url(culture);
    

    Give it a try

    You can also pass in a second parameter in order to get Relative/Absolute URL.

    Model.Url(culture, UrlMode.Absolute); // Returns Absolute URL
    Model.Url(culture, UrlMode.Relative); // Returns Relative URL
    

    URLMode is an optional parameter and is set to UrlMode.Auto by default.

    Hope that helps

  • giuseppe 8 posts 61 karma points
    1 week ago
    giuseppe
    0

    Thank you, it works perfectly!

Please Sign in or register to post replies

Write your reply to:

Draft