fix: path-form listing routes use the SEO module's resolved pagination
- journalPaginationSource answers runtimeConfig.public.seo.pagination (the SEO module's option with its defaults), else the raw seo.pagination - the module computes the paged routes inside its extendPages callback, so an app with only form: 'path' gets /blog/strona/:page and /blog/page/:page (L4 WR-03)
This commit is contained in:
@@ -88,6 +88,24 @@ export function journalPagedRouteName(key: keyof JournalRoutes, segment: string)
|
||||
return `${JOURNAL_ROUTE_NAMES[key]}-page-${segment}`
|
||||
}
|
||||
|
||||
/**
|
||||
* The pagination option the journal's path-form routes follow (P33-71, L4
|
||||
* WR-03): vue-seo-layer's resolved option, which its module's setup writes
|
||||
* into runtimeConfig.public.seo.pagination with its defaults (segments pl
|
||||
* strona, en page), so the routes match the links usePagination builds;
|
||||
* else the raw seo.pagination of the app's config. Read inside the
|
||||
* extendPages callback, which runs after every module's setup. No import
|
||||
* from vue-seo-layer: a git-installed layer's .ts is not type-stripped by
|
||||
* Node under node_modules.
|
||||
*/
|
||||
export function journalPaginationSource(nuxtOptions: unknown): unknown {
|
||||
if (nuxtOptions === null || typeof nuxtOptions !== 'object') return undefined
|
||||
const o = nuxtOptions as { runtimeConfig?: { public?: { seo?: { pagination?: unknown } } }; seo?: { pagination?: unknown } }
|
||||
const resolved = o.runtimeConfig?.public?.seo?.pagination
|
||||
if (resolved !== null && typeof resolved === 'object') return resolved
|
||||
return o.seo?.pagination
|
||||
}
|
||||
|
||||
/**
|
||||
* The extra listing routes of the path pagination form (D-40): with the
|
||||
* vue-seo-layer build option seo.pagination.form 'path', each listing gets
|
||||
|
||||
Reference in New Issue
Block a user