Copied to clipboard

Flag this post as spam?

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


  • DonZalmrol 220 posts 833 karma points
    Oct 31, 2020 @ 15:40
    DonZalmrol
    0

    Tags on site that have a space between words causes validation issues

    Hi,

    I use the build in Umbraco tags on my site that have a space between words, e.g. "abc def".

    This of course causes validators (W3C) to fall over the fact, the URL that would become: https://yoursite.com/tags?tag=abc def

    How can I change this work with an ID instead of the tag Name? e.g. https://yoursite.com/tags?tag=123

    I work with string tag = Request.QueryString["tag"]; to fetch the URL part starting after the '?'.

    Current code: http://pastie.org/p/5Sy9W4eXSvv6XtOLW1PIGW

    I can use the tag.Id in my url to push it to the tag logic, but from there it falls/ errors on the id since its suspecting a string due to: var tags = Umbraco.TagQuery.GetAllContentTags().OrderBy(t => t.Text);

    Note: The code itself works without any issues, same goes for fetching my tags, I wish to fix the w3c validation issues about the spaces.

    Other suggestions are welcome, thanks!

  • DonZalmrol 220 posts 833 karma points
    Oct 31, 2020 @ 16:58
    DonZalmrol
    100

    I think I might have found a workaround.

    Currently testing with replacing the space with an underscore '' by using .Replace(" ", "") on my regular page(s) and then on the tags page I convert the underscore '_' back to a space :)

    Seems to be working.

Please Sign in or register to post replies

Write your reply to:

Draft