Copied to clipboard

Flag this post as spam?

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


  • Michael Findley 6 posts 87 karma points
    Feb 20, 2018 @ 19:35
    Michael Findley
    0

    Current breadcrumbs setup. This works great to pull in my breadcrums, but I need to show a primary domain on certain sites. So basically would be something like

    If the site url is Primary.com show it in the breadcrumbs else do the below code. Is this possible and does it make sense. lol

    @{
        foreach(var page in Model.Ancestors().Where("Visible").Where("level > 1"))
        { 
           <li><a href="@page.Url">@page.Name</a></li>
        }
    
    }
    
  • Daniel Chenery 119 posts 465 karma points
    Feb 20, 2018 @ 22:40
    Daniel Chenery
    0

    Can you check Request.Url.AbsoluteUri for primary.com? I'm not 100% sure what you're asking.

    Do certain pages only need to show on a certain domain? Or do you need to show the domain in the breadcrumbs?

  • Nathan Woulfe 447 posts 1664 karma points MVP 5x hq c-trib
    Feb 20, 2018 @ 23:46
    Nathan Woulfe
    2

    I'd make this an option on a (base) content type rather than basing it on the requested URL.

    Then you could do something like this:

        @foreach(var page in Model.Ancestors().Where("Visible").Where("level > (Model.GetPropertyValue<bool>("showDomainInBreadCrumb") == true ? 0 : 1)"))
        { 
           <li><a href="@page.Url">@page.Name</a></li>
        }
    
  • Michael Findley 6 posts 87 karma points
    Feb 22, 2018 @ 20:59
    Michael Findley
    0

    Nathan, I like this way, but when I put that in place I get this error:

    Saving scripting file failed: e:\inetpub\wwwroot......(16): error CS1026: ) expected

  • Michael Findley 6 posts 87 karma points
    Feb 22, 2018 @ 21:02
    Michael Findley
    0

    So my content tree starts with folders. Each folder is a site with a primary domain.

    But one folder is a site then we have 3 other sites housed under it.

    Does this make sense?

  • Nigel Wilson 944 posts 2076 karma points
    Feb 22, 2018 @ 21:07
    Nigel Wilson
    0

    Hi Michael

    Maybe a screenshot of your actual site tree would be helpful to visualise the issue. Also maybe mock up a breadcrumb to describe what you want under each domain?

    Cheers, Nigel

  • Michael Findley 6 posts 87 karma points
    Feb 22, 2018 @ 22:16
    Michael Findley
    0

    I am thinking I cannot share the screenshot because of confidentiality.

    Let me try to rephrase my question.

    How would I do an if/else condition. Where if on google.com do this else just do this

    This is not correct syntax below. I just dropped in for the if/else statement.

    @if (google.com)
        {
        <li><a href="/">google.com</a></li>
            foreach (var page in Model.Ancestors().Where("Level > 1"))
            {
                <li><a href="@page.Url">@page.Name</a></li>
        }   
    }
    
    Else <!-- This would be my other sites that are not in the root of google.com.... -->
    foreach (var page in Model.Ancestors().Where("Visible"))
            {
                <li><a href="@page.Url">@page.Name</a></li>
        }   
    

    Again the above is way off on syntax but I hope it will show what I am trying to do .

Please Sign in or register to post replies

Write your reply to:

Draft