fix: HTML sitemap page 1 redirects with the locale's segment
- seoFirstPageRedirect answers the unnumbered URL or null when the target is the URL itself, so /mapa-strony/<group>/strona/1 no longer loops (L4 WR-01) - SeoHtmlSitemapPage takes the segment from the site answer, else the build option, else the param, and redirects only when the helper answers a target
This commit is contained in:
@@ -29,6 +29,17 @@ export function seoPageHref(url: string, page: number, form: SeoPaginationForm =
|
||||
return qs ? `${path}?${qs}` : path
|
||||
}
|
||||
|
||||
/**
|
||||
* Where an explicit page 1 (/mapa-strony/posty/strona/1, /blog?page=1)
|
||||
* redirects: the unnumbered URL, built with the locale's segment, or null
|
||||
* when that target is the URL itself (a segment the URL does not carry), so
|
||||
* a page never answers a 301 to its own address (L4 WR-01).
|
||||
*/
|
||||
export function seoFirstPageRedirect(fullPath: string, form: SeoPaginationForm, segment = '', param = 'page'): string | null {
|
||||
const target = seoPageHref(fullPath, 1, form, segment, param)
|
||||
return target === fullPath ? null : target
|
||||
}
|
||||
|
||||
/**
|
||||
* The page number a URL carries in the given form: 1 without one, the
|
||||
* number for a positive integer, null for anything else (a 404).
|
||||
|
||||
Reference in New Issue
Block a user