Copied to clipboard

Flag this post as spam?

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


  • Peter Kindberg 17 posts 107 karma points
    Nov 04, 2019 @ 14:43
    Peter Kindberg
    0

    Insert URL parameters to body

    Hello everyone,

    This is a tricky question, and I've been scratching my head about it for some time. I'm trying to create SEO pages that has a little extra functionality.

    The idea is to create a url like: www.site.com/services/web-developer/in/copenhagen

    There is a URL rewrite that redirect the user to www.site.com/services/web-developer/?place=Copenhagen - This has been achieved with a url rewrite, and working.

    The question is now how I can create a general feature in the grid & page rendering that looks for this url parameter. Ideally, I would like to validate the place to an actual city, for example if someone would rewrite it to new york (where I do not offer my services), the url would redirect back to the main page or omit the place parameter.

    If there name is a valid location, it would insert the text - using C#, not Javascript! - in the Grid and other texts where a markup has been found. The markup could be something like:

    Get a full stack developer{{url[place] : " in [place]" : " at your office"}}!

    If it's a valid location, it would render:

    Get a full stack developer in Copenhagen!

    If it's an invalid parameter, the text should render:

    Get a full stack developer at your office!

    This is scratching the surface of what I want to do, but I'm not sure how I can achieve this without making my code very messy. Regex is very likely an option, but where to place it not to clutter everything would be nice to know.

    Additionally, I will connect the place to a cost calculator and other things, so it's not just basic SEO fooling pages. :)

    Any insight would be greatly appreciated.

Please Sign in or register to post replies

Write your reply to:

Draft