Copied to clipboard

Flag this post as spam?

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


  • Dean 13 posts 123 karma points
    May 14, 2023 @ 18:04
    Dean
    0

    Add query string to node?

    Is it possible to add a query string to a node/page I created in Umbraco?

    Example of my site:

    Site

    --Products

    --Contact

    --About

    When someone clicks Contact the URL is

    www.site.com/contact
    

    Instead I would like to have it as

    www.site.com/contact?type=std
    

    Thanks

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    May 15, 2023 @ 11:11
    Marc Goodson
    100

    Hi Dean

    Is your 'Contact' page a different DocumentType to the other pages?

    If I've understood correctly I think you have two options, when you are writing out your navigation partial, there is presumably some kind of foreach loop and a call to .Url() to generate the Url for when people click it... you could, inside this foreach loop, check if the type of page, is your contact page Document Type and if so write out the link as .Url() + "?type=std"

    or you could create a custom 'UrlProvider' and target the Contact Document Type, so that whenever .Url() is called on the Contact page, your custom Url Provider takes over and appends the querystring:

    https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline#custom-url-provider

    Presumably though ?type=std sets the type of Contact you want to page to be a 'standard' one? so why not make the absence of a querystring 'meant that' - if you want that as the default??

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft