Canonical tag generated with "?page=2"?

(Benjamin Blackmer) #1

I’m attempting to clean up my site’s SEO, and after quite a bit of searching, it looks like Discourse is generating a canonical tag that includes a search query. For example:

If you view source on that, it includes the following:

<link href="" rel="canonical" />

I don’t know where that ?page=2 query parameter is coming from.

I’d love to make it so the canonical tag stays, but that the link doesn’t include the ?page=2 parameter.

Any ideas?

Missing canonical URL on direct post links
(Sam Saffron) #2

Try viewing that page without JS enabled and it should explain it :slight_smile: (there is a chrome plugin for that)

(Kane York) #3

No need for a plugin :grinning:

Click the gear icon in devtools, then Disable Javascript, then reload.

(Benjamin Blackmer) #4

Thanks @sam. I did that, but I’m not seeing anything.

(Sam Saffron) #5

Stuff is paginated if Javascript is disabled, that is what many crawlers see.

(Benjamin Blackmer) #6

Gotcha. Thanks.

Is it always page=2?

I’m trying to figure out how to get different pages to be same according to the crawlers. That page=2 is screwing it up.

(Kane York) #7

It’s ?page=2 because you linked to post 24, and they’re split into 20 posts when paged.

(Benjamin Blackmer) #8


Is there a way to make a canonical tag that removes the ?page=2? Moz is showing these as separate pages, and I can’t figure out how to combine them.

(Charles Walter) #9

Nice work to take this into consideration. Is there a page 2 being passed to the robot in the title tag? It’s great to have the page 2 etc in the canonical, but then the titles should also be unique some how.

(Jeff Atwood) #10

They are separate pages as viewed by Google’s crawler. This is correct. 20 posts per page.

(Benjamin Blackmer) #11

@codinghorror Is there a way within Discourse to make Google view these as the same page?

(Jeff Atwood) #12

No, because we intentionally present them to Google as paginated.

(Benjamin Blackmer) #13

Is there a way outside of Discourse to make Google view these as the same page?

(Mittineague) #14

But why would you want to?

Say there is a very long topic and what I’m searching for is in the middle.

Google would show my “search phrase” and the link would be to the beginning of the topic.
My choices would be to scroll hoping to find it, or use the Search - this topic.

Paginated would bring me closer to what I was interested in.

(Kane York) #15

Ideally, we could tell Google that each <article> has its own canonical url…

(Benjamin Blackmer) #16

I want a single topic page to be viewed as one page by Google. Instead, it looks like multiple pages if there are other 20 posts.

(Jeff Atwood) #17

As stated earlier, the “page” is a hint as to where in the discussion to load.

Imagine a discussion with 1000 replies. You search Google and get a search result hit on that discussion in reply number 505.

  • Do you want to be dumped at reply #1 and scroll down to #500 manually?

  • Wouldn’t it be better to be dumped at reply #500 and just have a tiny bit of scrolling to get to #505?

Hence, the page number.

(Charles Walter) #18

Note that in Google Webmasters they generally flag pages with unique URLs that share the same title. That’s why I was suggesting appending the title with a number.

(Benjamin Blackmer) #19

I actually want Google to view them all as the same page, hence the discussion.

(Charles Walter) #20

@benblackmer. Now I see the problem. I didn’t realize that every response was getting indexed with a unique URL. I would expect that could dilute the weight of the primary URL for the topic.

Here;s a sample Google search within our site where we can see around 100 similiar URLs / Titles showing up in the index.,

I have to think there’s a better way to optimize this.