mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: skip hidden posts while generating canonical url.
Previously, while generating the topic page's canoncial url we used the current post number. It will create invalid canonical path if the topic has whsiper posts. Now we only taking the visible posts for current page index calculation.
This commit is contained in:
@@ -122,7 +122,8 @@ class TopicView
|
||||
if @page > 1
|
||||
"?page=#{@page}"
|
||||
else
|
||||
page = ((@post_number - 1) / @limit) + 1
|
||||
posts_count = unfiltered_posts.where("post_number <= ?", @post_number).count
|
||||
page = ((posts_count - 1) / @limit) + 1
|
||||
page > 1 ? "?page=#{page}" : ""
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user