Copied to clipboard

Flag this post as spam?

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


  • Martin 278 posts 661 karma points
    May 20, 2019 @ 08:05
    Martin
    0

    Rename Home node in multisite / multilingual setup.

    Hi all,

    I have the following setup for a multisite / multilingual site (only in English just now).

    • Region
      • EN (Home)
        • Page
      • EN-FR (Home)
        • Page

    Im having an issue with my breadcrumb partial returning the page node name, EN and EN-FR.

    How can I "hardcode" the first node name?

    @{ var selection = Model.Content.Ancestors().Where("Level > 1").ToArray(); }
    
    @if (selection.Length > 0)
    {
        <ul class="breadcrumb">
            @* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@
            @foreach (var item in selection.OrderBy(x => x.Level))
            {
                <li><a href="@item.Url">@item.Name</a> <span class="divider">/</span></li>
            }
    
            @* Display the current page as the last item in the list *@
            <li class="active">@Model.Content.Name</li>
        </ul>
    }
    

    Thanks

    Martin

  • Markus Johansson 1756 posts 5137 karma points c-trib
    May 20, 2019 @ 20:10
    Markus Johansson
    0

    Hi Martin!

    I would surgest that you add a property on your document types, something like "Menu Text" or "Breadcrumb Text" to be able to configure the text for menus and/or the breadcrumb.

    Then when you render the names of the nodes you first check for this property and fallback to the node name if the property is not set.

    Would that work?

Please Sign in or register to post replies

Write your reply to:

Draft