@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.
@@ -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
+ }