Copied to clipboard

Flag this post as spam?

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


  • Steve 472 posts 1216 karma points
    Nov 02, 2015 @ 17:44
    Steve
    0

    URL for Unpublished Page

    We have time sensitive content, that cannot be seen before a certain date, but we need to give the URL of this webpage before it goes live to advertise for it. What is the best way to get the URL of a node that isn't published, without letting others on the web have access to it?

  • Kevin Jump 1536 posts 9827 karma points MVP 3x c-trib
    Nov 02, 2015 @ 17:56
    Kevin Jump
    100

    Hi

    if you add an umbracoUrlAlias property to a page, you can specify a url that doesn't have to be where it is on your site and you can then advertise that,

    when it's published the url will become active.

    https://our.umbraco.org/wiki/reference/umbraco-best-practices/umbracourlalias/

  • Steve 472 posts 1216 karma points
    Nov 03, 2015 @ 13:57
    Steve
    0

    How is the method for this generating the node url? Is there documentation on the actual Class method?

    We are using rules to determine which requests get sent to IIS (Umbraco) and which go to Apache.

  • Kevin Jump 1536 posts 9827 karma points MVP 3x c-trib
    Nov 03, 2015 @ 16:03
    Kevin Jump
    0

    Hi,

    this is actually part of the core Umbraco pipeline, so the code is in the core.

    So for completeness, it starts here: https://github.com/umbraco/Umbraco-CMS/blob/d50e49ad37fd5ca7bad2fd6e8fc994f3408ae70c/src/Umbraco.Web/Routing/AliasUrlProvider.cs#L60

    Ultimately the aliases are added to the mapping that umbraco will respond on. https://github.com/umbraco/Umbraco-CMS/blob/da85e4eb288717e4dd04be9419b6c04b053f9ed3/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs#L62

    but you don't need to worry about that, I would just say if you have an umbracoUrlAlias Umbraco sorts it out :)

    However If you have rules managing between IIS and Apache, I can't guarantee that you will always get through to umbraco. this method works best when all requests are going into the umbraco request pipeline (so IIS7+ or config to pass everything in IIS6).

  • Steve 472 posts 1216 karma points
    Nov 03, 2015 @ 16:33
    Steve
    0

    Thanks Kevin. After looking at the rules on the load balancing server, it appears, that for it to work, we will have to reference the alias in the address bar with an additional .aspx after the alias. Not a problem though. Thanks for your help!

  • Stefan Bohlin 6 posts 26 karma points
    Nov 02, 2015 @ 18:25
    Stefan Bohlin
    0

    As far as I can see in the source (don't hold me up on this), umbraco exposes a String Extension called ".ToUrlSegment()" which it uses to build the url's. (You need to add "Umbraco.Core" to the usings section).

    So you could do something like: Services.ContentService.GetById(1234).Name.ToUrlSegment()

    You could probably predict the url by traversing the tree and generate the url from the node names. And if you already know the parent url, then it will be easy to just append the predicted url of your unpublished node.

    I haven't tested this so it's just a guess :)

    Let me know if it works ;)

Please Sign in or register to post replies

Write your reply to:

Draft