Copied to clipboard

Flag this post as spam?

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


  • Søren Kottal 711 posts 4549 karma points MVP 6x c-trib
    Oct 12, 2015 @ 09:35
    Søren Kottal
    0

    Leave out an ancestor node in the url

    I have a structure like this:

    • Container (level 2)
      • Frontpage (level 3)
        • Page (level 4)

    This renders the url container/frontpage/page.

    I would like to have the url to be /frontpage/page - and besides that, have the frontpage have another url-name, ie. my-page. So in the end it's /my-page/page.

    Is that possible?

    The structure is imported in using the ContentService, from a set of html-files. The container is used to find where the imported pages should be located.

  • Mikkel Johansen 116 posts 292 karma points
    Oct 12, 2015 @ 12:34
    Mikkel Johansen
    0

    Have you tried playing with the "Culture and Hostnames" feature?

    Right click the "Frontpage" and then "Culture and Hostnames". Add the URL for example "http://mydomain.com". If you also run it local, you can add "localhost:xxxx" as a domain.

    Then the root will be the "Frontpage".

    In your example, you should probably add the URL to the "Container" node.

    I do not know if you can have a property that change the node's name in the url.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Oct 12, 2015 @ 12:35
    Douglas Robar
    0

    Overriding the default url Umbraco uses for a page is easily done.

    1. Create a textstring property on the doctype associated with your 'Frontpage (level 3)' page.
    2. Name the property something like 'Override url for this page'
    3. The alias for the property must be 'umbracoUrlName'

    Save the document type and go to the Content section and select the 'Frontpage' page. In the 'Override url for this page' field, enter the new url you want, such as 'my-page'.

    The second part of your question is a bit trickier. Certainly you could use an IUrlProvider or maybe a url rewrite rule in the site's web.config would do and would be less complex to implement or maintain over time.

    The first thing I'd try, though, is to right-click on the (level 3) page in the Content section and choose the 'Manage hostname and culture' option. Normally this is used to assign domain names for when you have multiple sites in your installation. But I wonder if, with a bit of trial and error you might not hit upon a solution by either assigning the domain to the level 3 page? It's worth a few minutes of experimentation before bothering with any custom rewrites or c# code.

    Let us know how you finally solve it.

    cheers,
    doug.

  • Mikkel Johansen 116 posts 292 karma points
    Oct 12, 2015 @ 12:41
    Mikkel Johansen
    0

    Looks like there is a "umbracoUrlName" property you can add to a node.

    https://our.umbraco.org/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline#segments

    So if this "umbracoUrlName" has a value, that string will be the node's name in the url.

Please Sign in or register to post replies

Write your reply to:

Draft