Copied to clipboard

Flag this post as spam?

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


  • Carlos Mosqueda 244 posts 435 karma points
    Apr 26, 2021 @ 19:41
    Carlos Mosqueda
    0

    Related Links and Multi URL picker, what if a page becomes unpublished? Umbraco 7 and 8

    I have a site using Umbraco 7 .12 so we are using related links until I can update it to 7.15 to use Multi URL Picker reliably. I know Umbraco 8 has been out and 9 is on the way, but the site is huge and will be a very large undertaking for right now.

    When using the Related Links, is there a way to use the "umbracoNaviHide" property to tell if a page is published or unpublished so that my editors don't have a bunch of dead links handing around.

    Same for the Multi URL Picker? If a page becomes unpublished will the link then become a dead link if chosen as an internal page internal to the Umbraco system.

    Thanks,

  • Amir Khan 1287 posts 2744 karma points
    Apr 26, 2021 @ 19:44
    Amir Khan
    0

    Here's an example for multi url, just add the where visible and it will check for the umbracoNaviHide property.

    var typedMultiNodeTreePicker = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("propertyAlias", true);
                foreach (var item in typedMultiNodeTreePicker.Where("Visible"))
    
  • Carlos Mosqueda 244 posts 435 karma points
    Apr 26, 2021 @ 20:30
    Carlos Mosqueda
    0

    Amir, Would that actually work if the URL is grabbed from the URL property?

    What about external links? Would the "Where" be null? Or just bypass it?

  • Amir Khan 1287 posts 2744 karma points
    Apr 26, 2021 @ 20:32
    Amir Khan
    0

    I didn't think about that. You'd probably want to check for external links or you could end up with a null object reference error?

  • Carlos Mosqueda 244 posts 435 karma points
    Apr 26, 2021 @ 21:05
    Carlos Mosqueda
    0

    @UmbracoHQ (if you all take a look at this),

    I see in the Umbraco 8.1+ documentation I see that the Multi URL Picker allows for the LnkType.ExternalURL and LinkType.Content ...

    Are those properties available in the View to use to tell the difference between an External link vs a Content node?

    It is not documented in the Umbraco 7.14+ or the 8.0+ version of the documentation.

  • Amir Khan 1287 posts 2744 karma points
    Apr 26, 2021 @ 21:17
    Amir Khan
    0

    I’ve had good luck tweeting @ hq before.

Please Sign in or register to post replies

Write your reply to:

Draft