Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Incubator Q&A

Welcome to the staging ground for new communities! Each proposal has a description in the "Descriptions" category and a body of questions and answers in "Incubator Q&A". You can ask questions (and get answers, we hope!) right away, and start new proposals.

Are you here to participate in a specific proposal? Click on the proposal tag (with the dark outline) to see only posts about that proposal and not all of the others that are in progress. Tags are at the bottom of each post.

How should canonical URLs be used with comments? Question

+4
−0

Canonical URLS are highly recommended for SEO and to prevent competition between duplicate pages. I've been trying to implement this, but I'm unsure how to implement this for pages which repeat but emphasize or expand portions.

Specifically, I'm trying to implement them for comment permalinks. The page still displays all of the main content, but one specific comment they're under is boosted to the top and its children replies are shown. Does that mean the comment should have its own canonical URL or should I redirect everything to the overall page since it's mostly the same?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+3
−0

A canonical URL should be the primary URL to represent ALL the content on the page. The URL that highlights a particular comment creates a variation of that page. The comment URL should never be the canonical URL, rather it should refer to the main URL for the page as the canonical URL.

For example, if your page is https://example.com/my-page, it could have a self-referencing canonical URL <link rel=canonical href=https://example.com/my-page>.

Then you might choose a URL for a particular comment from among several possibilities:

  • https://example.com/my-page#comment3
  • https://example.com/my-page-comment-3
  • https://example.com/comment-3

Regardless of which URL you choose to show a specific comment, the canonical URL should point back to the main URL for the page which includes the comment without highlighting it: <link rel=canonical href=https://example.com/my-page>

This is a case in which canonical links are needed rather than redirects. Redirects change the URL for users which wouldn't be desirable. You want to let users see the highlighted comment front and center. However search engines need to be told that the content on the page is duplicate and you would prefer that they index another variant.

If you don't use canonical URLs in this situation, search engines will detect the duplicate content and choose one one URL to index. They may or not make the correct choice to index the main URL for the page.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »