36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
type ArchivePathArgs = {
|
|
/** Archive page's slug in this locale, e.g. 'artykuly'. */
|
|
archiveSlug: string;
|
|
locale: string;
|
|
/** 1-based. Page 1 is omitted from the URL. */
|
|
page?: number;
|
|
};
|
|
/**
|
|
* Path to an archive listing: /pl/artykuly, /pl/artykuly?page=2.
|
|
*
|
|
* Pagination goes in the query string rather than the path. A path segment
|
|
* (/pl/artykuly/2) would be ambiguous with an entry slugged "2", and the
|
|
* alternative (/pl/artykuly/strona/2) drags in yet another localized segment to
|
|
* configure and translate. Google has understood ?page= for years, and
|
|
* rel=next/prev — the reason people used to prefer path segments — was retired.
|
|
*/
|
|
export declare function buildArchivePath({ archiveSlug, locale, page }: ArchivePathArgs): string;
|
|
type EntryPathArgs = {
|
|
/** Archive page's slug in this locale, e.g. 'artykuly'. */
|
|
archiveSlug: string;
|
|
/** Entry's slug in this locale, e.g. 'moj-post'. */
|
|
entrySlug: string;
|
|
locale: string;
|
|
};
|
|
/** Path to a single entry: /pl/artykuly/moj-post. */
|
|
export declare function buildEntryPath({ archiveSlug, entrySlug, locale }: EntryPathArgs): string;
|
|
/**
|
|
* Reads a page number out of a query parameter.
|
|
*
|
|
* Anything that isn't a positive integer is page 1 — `?page=abc`, `?page=-5`,
|
|
* `?page=1.5` and a repeated `?page=1&page=2` all have to resolve to something,
|
|
* and silently showing the first page beats a 500 on a URL a crawler invented.
|
|
*/
|
|
export declare function parsePageParam(value: string | string[] | undefined): number;
|
|
export {};
|