Copied to clipboard

Flag this post as spam?

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


  • Dennis 33 posts 238 karma points
    Oct 13, 2014 @ 10:21
    Dennis
    0

    Adding document match for /id

    Hi I am new to Umbraco and need help to a simple problem (I guess). 

    I have created a document type with a corresponing template called "Exhibition". Everything is fine and I can navigate to my newly created subpage /Exhibition. The next think I would like, is to add a an id to the url so I can use AngularJS to grab a specific exhibition from the URL e.g /Exhibition/3.

    I keep getting No umbraco document matches the url

    So how's the correct Umbraco way to set this up?

    Best regards!

  • Nicola Nauwynck 11 posts 76 karma points
    Oct 13, 2014 @ 10:40
    Nicola Nauwynck
    0

    Hey,

    You can add an id to the url by using parameters:

    <a class="btn" href="/exhibition/?id=1">
       Click me!
    </a>
    

    Clicking on the URL will open the page www.localhost.local/exhibition/?id=1

    If you want to "beatify" the params you should have a look in setting up IIS as I haven't found a way yet to configure this in the config.

    You could also make a subitem under exhibition that is called 1 so you would navigate to exhibition/1

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Oct 13, 2014 @ 11:20
    Dave Woestenborghs
    0

    You can create a Url Rewrite in the file /config/UrlRewriting.config or on IIS like Nicola mentioned.

    The problem with this solution is that it will break when you change the name of your page, because than the url also changes.

    Another solution is to use Route Hijacking. But that only works if you use the MVC view engine.

    More about route hijacking and custom routes can be found in the documentation : 

    http://our.umbraco.org/documentation/Reference/Templating/Mvc/custom-controllers
    http://our.umbraco.org/documentation/Reference/Templating/Mvc/custom-routes

    Dave 

  • Nicola Nauwynck 11 posts 76 karma points
    Oct 13, 2014 @ 20:26
    Nicola Nauwynck
    0

    Thanks Dave, I gave up on searching but this gives me a new perspective 😁

Please Sign in or register to post replies

Write your reply to:

Draft