I have a page located at example.com/tagged, which shows posts that contain the selected tag for which a person has searched.

So, if someone searched for #apple, then example.com/tagged/apple would show all posts tagged with the #apple hashtag, and example.com/tagged/orange would show all posts tagged with the #orange tag. Simple enough.

Now, Google is telling me it needs a canonical URL. In my code, do I just add the canonical tag for each hashtag?

Meaning, should the canonical tag be dynamic, so that when someone searches for #apple the tag is

<link rel="canonical" href="https://example.com/tagged/apple" />

and when someone searches for #orange it's

<link rel="canonical" href="https://example.com/tagged/orange" />

Is this how it works?


Yes, canonical url should be different for different content.
Since you have pages for each tag, no matter if it processed by same script, canonical is different for each one.
If some keywords are aliases, they should have same canonical.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.