XF 2.1 Adding a tag, randomly adds a number to the end of the url

JoyFreak

Well-known member
I'm really trying to get to the bottom of this and understand if it is normal XF behaviour, because ATM it doesn't make sense as to why it's doing that.

Why is it when I add a tag, it adds a number to the end of the URL?

For example, in the link below, I have the tag "The Witcher" but when you click the tag it takes you to "https://www.joyfreak.com/tags/the-witcher-4/"
Why is it adding a 4 in the end?

URL: https://www.joyfreak.com/articles/m...semir-role-in-the-witcher-netflix-series.262/

See, the tag https://www.joyfreak.com/tags/the-witcher/ does not exist.

I haven't added the tag "The witcher 4" as you can see in that post and in the screenshot provided, I've added "The witcher" only. I've tried deleting it and adding it in again and same thing. It seem ALL "The witcher" tag would result in the URL with the number 4 added in; in all threads!

hover.png

I need this fixed as my articles rely heavily on tags. As I add links within my posts that link to tags and when I am adding "The Witcher" in my url, it does not exist, instead the tag is the one with the number 4 in it.

Edit: this tag issue is one of many. It seems to be happening to a few other tags too.
 
It is possible for tag URLs to be ambiguous.

We didn't want to restrict too heavily which tags were allowed, so we do allow tags to contain certain special characters, but those special characters are sometimes not valid in a URL.

I have tagged this thread with two tags.

One is called bug and one is called bug!. Because ! is not valid for a URL, both tags would end up having a URL of bug.

Well, clearly, having two different tags with the same URL makes no sense. So the first one bug gets a URL of bug and the second one bug! gets a URL of bug-2.

I think that should mostly make sense, but I appreciate it doesn't specifically answer this question, but that's where we get to an interesting quirk.

It is correct, you do not have a tag with a URL of the-witcher nor the-witcher-2.

But you do have a tag that has a URL of the-witcher-3 which relates specifically to a tag which is called "the witcher 3". I would guess that this was created first.

The code that creates the URL version sees that the-witcher-3 already exists, and it kind of assumes that the-witcher-2 and the-witcher-1 and the-witcher already exists, so it increments by one and settles on the-witcher-4.

It's an odd quirk, admittedly, but it's doing exactly what we want it to do, which is to ensure there are no duplicate tag URLs.

However, this is a fairly long way of explaining, despite the solution being fairly simple.

You just need to go to Admin > Content > Tags and search for "witcher" in the filter bar at the top of the page.

Click on the tag called "the witcher" and there you can edit the tag URL portion to simply the-witcher.

That does fix it, but I have to point out that you seem overly concerned about this where you shouldn't be. No one cares about the URL portion of the tags. Search engines don't, your users won't, so while we can see a tag called "the witcher" with a URL of "the-witcher-4" and think that's odd, it has no material effect on anything else whatsoever.

But, at least you now know how to fix it if you wish.
 
I'm glad to know it's normal XF behaviour. I was beginning to think that some add-on had caused it and would have been difficult to replicate the issue.

The URL is not a concern of mine. It's mostly because I link keywords in my posts to tags and I only really noticed this when I clicked the links and it took me to a 404 page then realised that the tags had numbers on the end. But I am glad to know there is a "fix" for this.

Thanks for your time and swift reply!
 
Top Bottom