Copied to clipboard

Flag this post as spam?

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


  • giuseppe 9 posts 66 karma points
    Jul 10, 2019 @ 15:00
    giuseppe
    1

    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 45 posts 175 karma points c-trib
    Jul 10, 2019 @ 15:56
    Luke Hook
    103

    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 9 posts 66 karma points
    Jul 11, 2019 @ 09:29
    giuseppe
    0

    Thank you, it works perfectly!

Please Sign in or register to post replies

Write your reply to:

Draft