How insert pagination pages in sitemap.xml


#1

For example
in blog i use
{{$paginator := .Paginate (where .Data.Pages “Type” “news”) }}
{{ range $paginator.Pages }}

And hugo create:
news
news/page/2/,
news/page/3/
But how i can include this links (news/page/2/, etc) in sitemap.xml, because now sitemap contain only
news page.


#2

try

{{ range .Site.AllPages }}

{{ range .Site.Pages }}

or

{{ range .Site.RegularPages }}

sorry, q&d


#3

did not help
I understand why so because $pagination local variable and sitemap.xml cannot see it


#4

You cannot paginate the sitemap. I don’t see how that would make sense.


#5

Sorry, maybe I have incomprehensibly described.
My task now is this:

There are pagination pages where everything works fine.
Hugo create page with url domain + “news”, “news/page/2/”, “page/3/”

But in sitemap.xml i have ony page “news”,
without pagination pages
(no pagination pages in sitemap.xml “news/page/2/”, “page/3/” absent)


#6

A sitemap.xml document is to give search engines and other automated services to slurp up a listing of unique documents on a given website. Pagination on the other hand is for humans to “page” long listings in a way that is easier for our brains to understand.

Paginated directories and their URLs has no place in a sitemap.xml. It is for bots, not humans. The bots know what their doing.

Do you have a use case that runs contrary to this? I’m open to it. :slight_smile:


#7

Yes, thanks, after a long search on the Internet and expert advice, I found a solution that pages with pagination are really unnecessary in the site map.

In my opinion they were needed, but it turned out I was wrong

Thanks for the answer :slight_smile:
Problem solved