@ciderpress/ui 1.0.0-rc.11 → 1.0.0-rc.12
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/dist/node.mjs +702 -13
- package/dist/theme/components/seo-head-data.test.ts +196 -0
- package/dist/theme/components/seo-head-data.ts +490 -0
- package/dist/theme/components/seo-head.tsx +102 -0
- package/dist/theme/components/shared/IssueLinkIcon.tsx +42 -0
- package/dist/theme/components/shared/issue-link.css +74 -0
- package/dist/theme/index.tsx +1 -0
- package/dist/theme/lib/seo-url.ts +28 -0
- package/package.json +5 -4
- package/src/theme/components/seo-head-data.test.ts +196 -0
- package/src/theme/components/seo-head-data.ts +490 -0
- package/src/theme/components/seo-head.tsx +102 -0
- package/src/theme/components/shared/IssueLinkIcon.tsx +42 -0
- package/src/theme/components/shared/issue-link.css +74 -0
- package/src/theme/index.tsx +1 -0
- package/src/theme/lib/seo-url.ts +28 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the production root URL for a base-mounted documentation site.
|
|
3
|
+
*
|
|
4
|
+
* @param params - Production origin and resolved Rspress base path
|
|
5
|
+
* @returns Absolute URL for the deployed site root
|
|
6
|
+
*/
|
|
7
|
+
export function resolveSeoSiteUrl(params: {
|
|
8
|
+
readonly origin: string
|
|
9
|
+
readonly base: string
|
|
10
|
+
}): string {
|
|
11
|
+
return new URL(params.base, params.origin).href
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a basename-stripped router pathname against the deployed site root.
|
|
16
|
+
*
|
|
17
|
+
* @param params - Production origin, resolved Rspress base, and router pathname
|
|
18
|
+
* @returns Absolute production URL for the page
|
|
19
|
+
*/
|
|
20
|
+
export function resolveSeoPageUrl(params: {
|
|
21
|
+
readonly origin: string
|
|
22
|
+
readonly base: string
|
|
23
|
+
readonly pathname: string
|
|
24
|
+
}): string {
|
|
25
|
+
const siteUrl = resolveSeoSiteUrl(params)
|
|
26
|
+
const relativePathname = params.pathname.replace(/^\/+/, '')
|
|
27
|
+
return new URL(relativePathname, siteUrl).href
|
|
28
|
+
}
|