On my site I have something like little blog (PHP and MySQL dynamically loaded posts), with categories like "life", "business", and "health". Each article has added tags. Tags allow to find articles with specified tags. I have on my home page a "news" section with 3 newest posts (any category, just filter by date).

An example of a post would be titled "My own garden" in the category "life", with tags "hobby" and "free-time". The original URL for this post would be http://example/blog/life/my-own-garden.html. On my home page it shows up as "My own garden" with the first 100 characters of the article, and a "Read more" link to the full post.

At my blog page with address http://example/blog/ I see that same shortened post (first 100 chars) and others posts from any category, with link "Read more" to original page, where user can read full post.

At my category page with address http://example/blog/life I see that same shortened post (first 100 chars) and other post from that same category, with link to original page, where user can read full post.

At my tag page with URL http://example/tag/hobby.html AND http://example/tag/free-time.html I see that same post and other posts with that same tag (doesn't matter which category they are)

And at the end I have that same content at page as I named originally - http://example/blog/life/my-own-garden.html

So, I have 5 pages which have that same part of content or that same fully content. Data is loaded dynamically, for ex. http://example/blog/life/my-own-garden.html and http://example/blog/life/best-free-time-ever.html are powered by the same file, just with different posts.

How could I set canonical links in this situation, is any way to do it correct?

With the exception of http://example/blog/life/my-own-garden.html all the other pages you mentioned contain part of the original post and/or link to it. So the canonical version of the post is the aforementioned url where the content can be found in its entirety. Any other url mentioned in your original post contains links/excerpts to/of the original content, so no reason to use these urls as the canonical for your post.

Also, I don't think you have a correct understanding of the way canonical links work. You need only one canonical url and you are going to add it in the page that contains the content. All the other pages you mentioned

http://example/blog/
http://example/blog/life
http://example/tag/hobby.html

etc..

are bound to contain links/excerpts to other posts as well. For example, the third url probably contains links to other posts marked as "hobby" so it makes no sense to add canonical link for a specific page, since we are talking about a category page.

The only page that needs a canonical URL is the page containing your post in its entirety. The only situation where you need to decide where to place your canonical link is when you have different urls that contain the post in its entirety http://example/blog/life/mypost and http://example/blog/hobby/mypost or http://example/blog/someCategory/someSumCategory/mypost.

Correct me if I am mistaken, but your situation is just a bunch of category pages linking to your (single) page containing the post in question. So just add a canonical link in http://example/blog/life/my-own-garden.html linking to itself and you are good to go.

In case you actually do have different urls than end up in your post, just select which url you want to have as your canonical and add canonical link to all the different urls (with same content) linking to your chosen url. So out of the various urls linking to the same post (in its entirety!!) one will have canonical to itself and the others will have canonicals to the former.

  • Thanks for answer. – AK994 Nov 26 at 13:46
  • @AK994 if this answers your question please consider marking it as accepted. – Σπύρος Γούλας Nov 26 at 15:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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