@sarimarcus/content-sites-core 0.38.1 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.js +1 -1
- package/dist/schema/context.js +3 -3
- package/dist/schema/hours.d.ts +2 -0
- package/dist/schema/hours.js +4 -2
- package/dist/schema/hoursDisplay.js +3 -4
- package/dist/schema/types.d.ts +1 -1
- package/dist/url/index.d.ts +1 -1
- package/dist/url/index.js +1 -1
- package/dist/url/routes.d.ts +2 -0
- package/dist/url/routes.js +5 -1
- package/package.json +1 -1
- package/src/config/index.ts +1 -1
- package/src/schema/context.ts +3 -3
- package/src/schema/hours.ts +4 -2
- package/src/schema/hoursDisplay.ts +3 -4
- package/src/schema/types.ts +1 -1
- package/src/url/index.ts +1 -1
- package/src/url/routes.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.40.0 (2026-10-18)
|
|
6
|
+
|
|
7
|
+
- `url`: new `routeSegment(kind, routes?)` (override, then `DEFAULT_ROUTES`, then the kind's own name); `routePath` uses it. `schema`: `ctx.route` and `resolveAuthor` resolve through it, so one `SiteRoutes` override moves links and JSON-LD URLs together. Before, the schema context only read its own `routes` and the author URL was always `/author/` (SLA-3046).
|
|
8
|
+
|
|
9
|
+
### Breaking
|
|
10
|
+
|
|
11
|
+
- `./config` no longer exports `mergeConfig`, `resolveConfig`, `siteConfigValues` or `hasCapability` (no importer existed; the module stays internal until a consumer needs it). `scripts/platform/migrations/remove-deprecated.mjs` asserts a site imports none of them (SLA-3046).
|
|
12
|
+
|
|
13
|
+
## 0.39.0 (2026-10-16)
|
|
14
|
+
|
|
15
|
+
- `schema`: `hours.ts` exports `CLOCK_TIME`, the clock-time pattern `parseHoursShifts` and `latestClosing` now share; no behaviour change (SLA-3045).
|
|
16
|
+
|
|
5
17
|
## 0.38.1 (2026-10-15)
|
|
6
18
|
|
|
7
19
|
- No changes; lockstep release with tourism (SLA-3125).
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ today's ui components import from tourism code).
|
|
|
6
6
|
|
|
7
7
|
Named entry points: `url`, `affiliate`, `dates`, `geo`, `dom`, `text`, `config`, `types`, `schema`, `interludes`, `images` and `articles` (`src/internal` is never exported). No `.astro`
|
|
8
8
|
files. Lowest layer: imports nothing from the other packages; its one runtime dependency is `marked` (`readingTime`). Ownership per path is in
|
|
9
|
-
|
|
9
|
+
`data/snapshots/platform/catalogue.json` (owner `core`).
|
|
10
10
|
|
|
11
11
|
Code Node loads directly (config builders imported by `astro.config.mjs`) ships compiled to `dist/` with
|
|
12
12
|
type declarations. Node will not strip types from files under `node_modules`. So every entry point resolves to
|
package/dist/config/index.d.ts
CHANGED
|
@@ -3,4 +3,3 @@ export type { SiteConfigOptions, SitemapRule, PagefindIntegration } from './site
|
|
|
3
3
|
export { outboundLinkRel } from './outboundLinkRel.ts';
|
|
4
4
|
export type { OutboundLinkRelOptions } from './outboundLinkRel.ts';
|
|
5
5
|
export { latestGuideDate, guideDateMap, guidePublishDates } from './guideDates.ts';
|
|
6
|
-
export { mergeConfig, resolveConfig, siteConfigValues, hasCapability } from './precedence.ts';
|
package/dist/config/index.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
export { defineSiteConfig, buildLastmodMap, sitemapSerialize, PAGEFIND_EXCLUDE_SELECTORS } from "./siteConfig.js";
|
|
3
3
|
export { outboundLinkRel } from "./outboundLinkRel.js";
|
|
4
4
|
export { latestGuideDate, guideDateMap, guidePublishDates } from "./guideDates.js";
|
|
5
|
-
|
|
5
|
+
// precedence.ts (resolveConfig & co.) is internal until a consumer needs it: SLA-3046.
|
package/dist/schema/context.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeSiteUrl, toAbsoluteSiteUrl } from "../url/index.js";
|
|
1
|
+
import { normalizeSiteUrl, routeSegment, toAbsoluteSiteUrl } from "../url/index.js";
|
|
2
2
|
import { slugify } from "../text/index.js";
|
|
3
3
|
/** The site root with a trailing slash (either form) collapses to the bare base URL. */
|
|
4
4
|
export function normalizeHomepageUrl(url, siteUrl, siteBaseUrl) {
|
|
@@ -61,7 +61,7 @@ export function createSchemaContext(input) {
|
|
|
61
61
|
websiteId: `${siteBaseUrl}#website`,
|
|
62
62
|
abs: (path) => `${siteUrl}${basePath}${path}`,
|
|
63
63
|
absOrHttp: (path) => (path.startsWith('http') ? path : `${siteUrl}${basePath}${path}`),
|
|
64
|
-
route: (kind, slug) => `${siteUrl}${basePath}/${
|
|
64
|
+
route: (kind, slug) => `${siteUrl}${basePath}/${routeSegment(kind, routes)}/${slug}`,
|
|
65
65
|
fileExists,
|
|
66
66
|
// /images/{type}/{name}.webp → /images/og/{type}/{name}.jpg, falling back to the slug's jpg (SLA-2817);
|
|
67
67
|
// omitted rather than pointing at a file that is not there.
|
|
@@ -81,7 +81,7 @@ export function createSchemaContext(input) {
|
|
|
81
81
|
if (!authorName)
|
|
82
82
|
return null;
|
|
83
83
|
const profile = input.findAuthor?.(authorName);
|
|
84
|
-
const url =
|
|
84
|
+
const url = ctx.route('author', profile?.slug || slugify(authorName));
|
|
85
85
|
const image = profile?.photo
|
|
86
86
|
? (profile.photo.startsWith('http') ? profile.photo : `${siteUrl}${basePath}${profile.photo}`)
|
|
87
87
|
: undefined;
|
package/dist/schema/hours.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare const DAY_KEYS: readonly ["monday", "tuesday", "wednesday", "thur
|
|
|
3
3
|
export type DayKey = (typeof DAY_KEYS)[number];
|
|
4
4
|
/** The value an `openingHours` bucket uses for a day open around the clock. */
|
|
5
5
|
export declare const HOURS_ALWAYS_OPEN = "24h";
|
|
6
|
+
/** A clock time as hours values write it (`9:30`, `21:00`). */
|
|
7
|
+
export declare const CLOCK_TIME: RegExp;
|
|
6
8
|
export interface OpeningHoursInput {
|
|
7
9
|
weekdays?: unknown;
|
|
8
10
|
weekends?: unknown;
|
package/dist/schema/hours.js
CHANGED
|
@@ -11,6 +11,8 @@ const SHORT_TO_KEY = {
|
|
|
11
11
|
};
|
|
12
12
|
/** The value an `openingHours` bucket uses for a day open around the clock. */
|
|
13
13
|
export const HOURS_ALWAYS_OPEN = '24h';
|
|
14
|
+
/** A clock time as hours values write it (`9:30`, `21:00`). */
|
|
15
|
+
export const CLOCK_TIME = /^\d{1,2}:\d{2}$/;
|
|
14
16
|
/**
|
|
15
17
|
* Splits a (possibly split-shift) bucket value such as `"13:00-16:00, 20:00-23:30"` into one pair per shift.
|
|
16
18
|
* A shift whose halves are not both clock times is dropped (SLA-2303); `24h` spans the whole day.
|
|
@@ -27,8 +29,8 @@ export function parseHoursShifts(value) {
|
|
|
27
29
|
return { opens: opens?.trim(), closes: closes?.trim() };
|
|
28
30
|
})
|
|
29
31
|
.filter((shift) => Boolean(shift.opens && shift.closes)
|
|
30
|
-
&&
|
|
31
|
-
&&
|
|
32
|
+
&& CLOCK_TIME.test(shift.opens)
|
|
33
|
+
&& CLOCK_TIME.test(shift.closes));
|
|
32
34
|
}
|
|
33
35
|
/** Days a free-text `closed` field names ("Tuesdays", "Monday and Sunday"), in Monday-first order. */
|
|
34
36
|
export function closedFieldDays(closed) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// Reader-facing hours on resolveOpeningHours, the JSON-LD's day resolution; values stay as written (SLA-3023).
|
|
2
|
-
import { DAY_KEYS, HOURS_ALWAYS_OPEN, resolveOpeningHours } from "./hours.js";
|
|
2
|
+
import { CLOCK_TIME, DAY_KEYS, HOURS_ALWAYS_OPEN, resolveOpeningHours } from "./hours.js";
|
|
3
3
|
const SHORT = {
|
|
4
4
|
monday: 'Mon', tuesday: 'Tue', wednesday: 'Wed', thursday: 'Thu', friday: 'Fri', saturday: 'Sat', sunday: 'Sun',
|
|
5
5
|
};
|
|
6
6
|
const DAY_INDEX = Object.fromEntries(DAY_KEYS.map((d, i) => [d, i]));
|
|
7
|
-
const HHMM = /^\d{1,2}:\d{2}$/;
|
|
8
7
|
const RANGE_SEP = /\s*[-–]\s*/;
|
|
9
8
|
function displayValue(raw) {
|
|
10
9
|
const v = raw.trim();
|
|
@@ -86,7 +85,7 @@ function minutes(hhmm) {
|
|
|
86
85
|
// 22:30-05:00 close above a 22:30-07:00 one.
|
|
87
86
|
function closeRank(open, close) {
|
|
88
87
|
const c = minutes(close);
|
|
89
|
-
if (open &&
|
|
88
|
+
if (open && CLOCK_TIME.test(open))
|
|
90
89
|
return c <= minutes(open) ? c + 1440 : c;
|
|
91
90
|
return c;
|
|
92
91
|
}
|
|
@@ -108,7 +107,7 @@ export function latestClosing(h) {
|
|
|
108
107
|
continue;
|
|
109
108
|
const shifts = raw.split(',').map((s) => s.trim()).filter(Boolean);
|
|
110
109
|
const [open, close] = (shifts[shifts.length - 1] ?? '').split(RANGE_SEP).map((s) => s.trim());
|
|
111
|
-
if (!close || !
|
|
110
|
+
if (!close || !CLOCK_TIME.test(close))
|
|
112
111
|
continue;
|
|
113
112
|
const rank = closeRank(open, close);
|
|
114
113
|
if (rank > bestRank) {
|
package/dist/schema/types.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface ResolvedAuthor {
|
|
|
28
28
|
image?: string;
|
|
29
29
|
sameAs?: string[];
|
|
30
30
|
}
|
|
31
|
-
/** Path segment per
|
|
31
|
+
/** Path segment per kind, e.g. `{ hotel: 'lodges' }`; the same map as `SiteRoutes`. A kind not listed uses `DEFAULT_ROUTES`, then its own name. */
|
|
32
32
|
export type RouteMap = Partial<Record<string, string>>;
|
|
33
33
|
export interface SchemaContextInput {
|
|
34
34
|
/** Site origin, with or without a trailing slash. */
|
package/dist/url/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { buildImageMap } from './imageMap.ts';
|
|
|
5
5
|
export { articleFeedItem } from './feed.ts';
|
|
6
6
|
export type { FeedArticle, FeedItem } from './feed.ts';
|
|
7
7
|
export { pageTypeOf } from './pageType.ts';
|
|
8
|
-
export { DEFAULT_ROUTES, routePath } from './routes.ts';
|
|
8
|
+
export { DEFAULT_ROUTES, routePath, routeSegment } from './routes.ts';
|
|
9
9
|
export type { RouteKind, SiteRoutes } from './routes.ts';
|
|
10
10
|
export { outboundClassifier, outboundHostKey, applyOutboundRel } from './outbound.ts';
|
|
11
11
|
export type { OutboundDomainStore } from './outbound.ts';
|
package/dist/url/index.js
CHANGED
|
@@ -5,6 +5,6 @@ export { normalizeHref, extractProseHrefs, dedupRelated } from "./relatedDedup.j
|
|
|
5
5
|
export { buildImageMap } from "./imageMap.js";
|
|
6
6
|
export { articleFeedItem } from "./feed.js";
|
|
7
7
|
export { pageTypeOf } from "./pageType.js";
|
|
8
|
-
export { DEFAULT_ROUTES, routePath } from "./routes.js";
|
|
8
|
+
export { DEFAULT_ROUTES, routePath, routeSegment } from "./routes.js";
|
|
9
9
|
export { outboundClassifier, outboundHostKey, applyOutboundRel } from "./outbound.js";
|
|
10
10
|
export { RELATED_ZONE_ROLES, closerHeading, featuredInGuides, buildTakenHrefs } from "./relatedZone.js";
|
package/dist/url/routes.d.ts
CHANGED
|
@@ -7,5 +7,7 @@ export declare const DEFAULT_ROUTES: {
|
|
|
7
7
|
};
|
|
8
8
|
export type RouteKind = keyof typeof DEFAULT_ROUTES;
|
|
9
9
|
export type SiteRoutes = Partial<Record<RouteKind, string>>;
|
|
10
|
+
/** Path segment for `kind`: the site's override, then `DEFAULT_ROUTES`, then the kind's own name (vertical entity kinds). */
|
|
11
|
+
export declare function routeSegment(kind: string, routes?: Partial<Record<string, string>>): string;
|
|
10
12
|
/** `/<segment>` for `kind`, or `/<segment>/<slug>`, from `routes` first and then the default. Base path not applied. */
|
|
11
13
|
export declare function routePath(kind: RouteKind, slug?: string, routes?: SiteRoutes): string;
|
package/dist/url/routes.js
CHANGED
|
@@ -5,8 +5,12 @@ export const DEFAULT_ROUTES = {
|
|
|
5
5
|
author: 'author',
|
|
6
6
|
neighborhood: 'neighborhood',
|
|
7
7
|
};
|
|
8
|
+
/** Path segment for `kind`: the site's override, then `DEFAULT_ROUTES`, then the kind's own name (vertical entity kinds). */
|
|
9
|
+
export function routeSegment(kind, routes = {}) {
|
|
10
|
+
return routes[kind] ?? DEFAULT_ROUTES[kind] ?? kind;
|
|
11
|
+
}
|
|
8
12
|
/** `/<segment>` for `kind`, or `/<segment>/<slug>`, from `routes` first and then the default. Base path not applied. */
|
|
9
13
|
export function routePath(kind, slug, routes = {}) {
|
|
10
|
-
const segment =
|
|
14
|
+
const segment = routeSegment(kind, routes);
|
|
11
15
|
return slug === undefined ? `/${segment}` : `/${segment}/${slug}`;
|
|
12
16
|
}
|
package/package.json
CHANGED
package/src/config/index.ts
CHANGED
|
@@ -4,4 +4,4 @@ export type { SiteConfigOptions, SitemapRule, PagefindIntegration } from './site
|
|
|
4
4
|
export { outboundLinkRel } from './outboundLinkRel.ts';
|
|
5
5
|
export type { OutboundLinkRelOptions } from './outboundLinkRel.ts';
|
|
6
6
|
export { latestGuideDate, guideDateMap, guidePublishDates } from './guideDates.ts';
|
|
7
|
-
|
|
7
|
+
// precedence.ts (resolveConfig & co.) is internal until a consumer needs it: SLA-3046.
|
package/src/schema/context.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeSiteUrl, toAbsoluteSiteUrl } from '../url/index.ts';
|
|
1
|
+
import { normalizeSiteUrl, routeSegment, toAbsoluteSiteUrl } from '../url/index.ts';
|
|
2
2
|
import { slugify } from '../text/index.ts';
|
|
3
3
|
import type { JsonLdNode, ResolvedAuthor, SchemaContext, SchemaContextInput } from './types.ts';
|
|
4
4
|
|
|
@@ -65,7 +65,7 @@ export function createSchemaContext(input: SchemaContextInput): SchemaContext {
|
|
|
65
65
|
websiteId: `${siteBaseUrl}#website`,
|
|
66
66
|
abs: (path) => `${siteUrl}${basePath}${path}`,
|
|
67
67
|
absOrHttp: (path) => (path.startsWith('http') ? path : `${siteUrl}${basePath}${path}`),
|
|
68
|
-
route: (kind, slug) => `${siteUrl}${basePath}/${
|
|
68
|
+
route: (kind, slug) => `${siteUrl}${basePath}/${routeSegment(kind, routes)}/${slug}`,
|
|
69
69
|
fileExists,
|
|
70
70
|
// /images/{type}/{name}.webp → /images/og/{type}/{name}.jpg, falling back to the slug's jpg (SLA-2817);
|
|
71
71
|
// omitted rather than pointing at a file that is not there.
|
|
@@ -82,7 +82,7 @@ export function createSchemaContext(input: SchemaContextInput): SchemaContext {
|
|
|
82
82
|
resolveAuthor(authorName) {
|
|
83
83
|
if (!authorName) return null;
|
|
84
84
|
const profile = input.findAuthor?.(authorName);
|
|
85
|
-
const url =
|
|
85
|
+
const url = ctx.route('author', profile?.slug || slugify(authorName));
|
|
86
86
|
const image = profile?.photo
|
|
87
87
|
? (profile.photo.startsWith('http') ? profile.photo : `${siteUrl}${basePath}${profile.photo}`)
|
|
88
88
|
: undefined;
|
package/src/schema/hours.ts
CHANGED
|
@@ -16,6 +16,8 @@ const SHORT_TO_KEY: Record<string, DayKey> = {
|
|
|
16
16
|
|
|
17
17
|
/** The value an `openingHours` bucket uses for a day open around the clock. */
|
|
18
18
|
export const HOURS_ALWAYS_OPEN = '24h';
|
|
19
|
+
/** A clock time as hours values write it (`9:30`, `21:00`). */
|
|
20
|
+
export const CLOCK_TIME = /^\d{1,2}:\d{2}$/;
|
|
19
21
|
|
|
20
22
|
export interface OpeningHoursInput {
|
|
21
23
|
weekdays?: unknown;
|
|
@@ -48,8 +50,8 @@ export function parseHoursShifts(value: string): Array<{ opens: string; closes:
|
|
|
48
50
|
})
|
|
49
51
|
.filter((shift): shift is { opens: string; closes: string } =>
|
|
50
52
|
Boolean(shift.opens && shift.closes)
|
|
51
|
-
&&
|
|
52
|
-
&&
|
|
53
|
+
&& CLOCK_TIME.test(shift.opens)
|
|
54
|
+
&& CLOCK_TIME.test(shift.closes));
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
/** Days a free-text `closed` field names ("Tuesdays", "Monday and Sunday"), in Monday-first order. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Reader-facing hours on resolveOpeningHours, the JSON-LD's day resolution; values stay as written (SLA-3023).
|
|
2
|
-
import { DAY_KEYS, HOURS_ALWAYS_OPEN, resolveOpeningHours, type DayKey } from './hours.ts';
|
|
2
|
+
import { CLOCK_TIME, DAY_KEYS, HOURS_ALWAYS_OPEN, resolveOpeningHours, type DayKey } from './hours.ts';
|
|
3
3
|
|
|
4
4
|
export type OpeningHours = {
|
|
5
5
|
weekdays?: string;
|
|
@@ -24,7 +24,6 @@ const SHORT: Record<DayKey, string> = {
|
|
|
24
24
|
monday: 'Mon', tuesday: 'Tue', wednesday: 'Wed', thursday: 'Thu', friday: 'Fri', saturday: 'Sat', sunday: 'Sun',
|
|
25
25
|
};
|
|
26
26
|
const DAY_INDEX = Object.fromEntries(DAY_KEYS.map((d, i) => [d, i])) as Record<DayKey, number>;
|
|
27
|
-
const HHMM = /^\d{1,2}:\d{2}$/;
|
|
28
27
|
const RANGE_SEP = /\s*[-–]\s*/;
|
|
29
28
|
|
|
30
29
|
function displayValue(raw: string): string {
|
|
@@ -109,7 +108,7 @@ function minutes(hhmm: string): number {
|
|
|
109
108
|
// 22:30-05:00 close above a 22:30-07:00 one.
|
|
110
109
|
function closeRank(open: string | undefined, close: string): number {
|
|
111
110
|
const c = minutes(close);
|
|
112
|
-
if (open &&
|
|
111
|
+
if (open && CLOCK_TIME.test(open)) return c <= minutes(open) ? c + 1440 : c;
|
|
113
112
|
return c;
|
|
114
113
|
}
|
|
115
114
|
|
|
@@ -130,7 +129,7 @@ export function latestClosing(h: OpeningHours | undefined | null): { time: strin
|
|
|
130
129
|
if (!raw || raw === HOURS_ALWAYS_OPEN) continue;
|
|
131
130
|
const shifts = raw.split(',').map((s) => s.trim()).filter(Boolean);
|
|
132
131
|
const [open, close] = (shifts[shifts.length - 1] ?? '').split(RANGE_SEP).map((s) => s.trim());
|
|
133
|
-
if (!close || !
|
|
132
|
+
if (!close || !CLOCK_TIME.test(close)) continue;
|
|
134
133
|
const rank = closeRank(open, close);
|
|
135
134
|
if (rank > bestRank) {
|
|
136
135
|
bestRank = rank;
|
package/src/schema/types.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface ResolvedAuthor {
|
|
|
34
34
|
sameAs?: string[];
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/** Path segment per
|
|
37
|
+
/** Path segment per kind, e.g. `{ hotel: 'lodges' }`; the same map as `SiteRoutes`. A kind not listed uses `DEFAULT_ROUTES`, then its own name. */
|
|
38
38
|
export type RouteMap = Partial<Record<string, string>>;
|
|
39
39
|
|
|
40
40
|
export interface SchemaContextInput {
|
package/src/url/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { buildImageMap } from './imageMap.ts';
|
|
|
6
6
|
export { articleFeedItem } from './feed.ts';
|
|
7
7
|
export type { FeedArticle, FeedItem } from './feed.ts';
|
|
8
8
|
export { pageTypeOf } from './pageType.ts';
|
|
9
|
-
export { DEFAULT_ROUTES, routePath } from './routes.ts';
|
|
9
|
+
export { DEFAULT_ROUTES, routePath, routeSegment } from './routes.ts';
|
|
10
10
|
export type { RouteKind, SiteRoutes } from './routes.ts';
|
|
11
11
|
export { outboundClassifier, outboundHostKey, applyOutboundRel } from './outbound.ts';
|
|
12
12
|
export type { OutboundDomainStore } from './outbound.ts';
|
package/src/url/routes.ts
CHANGED
|
@@ -9,8 +9,13 @@ export const DEFAULT_ROUTES = {
|
|
|
9
9
|
export type RouteKind = keyof typeof DEFAULT_ROUTES;
|
|
10
10
|
export type SiteRoutes = Partial<Record<RouteKind, string>>;
|
|
11
11
|
|
|
12
|
+
/** Path segment for `kind`: the site's override, then `DEFAULT_ROUTES`, then the kind's own name (vertical entity kinds). */
|
|
13
|
+
export function routeSegment(kind: string, routes: Partial<Record<string, string>> = {}): string {
|
|
14
|
+
return routes[kind] ?? (DEFAULT_ROUTES as Record<string, string>)[kind] ?? kind;
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
/** `/<segment>` for `kind`, or `/<segment>/<slug>`, from `routes` first and then the default. Base path not applied. */
|
|
13
18
|
export function routePath(kind: RouteKind, slug?: string, routes: SiteRoutes = {}): string {
|
|
14
|
-
const segment =
|
|
19
|
+
const segment = routeSegment(kind, routes);
|
|
15
20
|
return slug === undefined ? `/${segment}` : `/${segment}/${slug}`;
|
|
16
21
|
}
|