@reblu/site-next 1.18.0 → 1.19.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @reblu/site-next
2
2
 
3
+ ## 1.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fd17765: `@reblu/site-next/seo`: home / site-level metadata (REB-651). `buildMetadata({ config, home: true })` titles the home page with the site `seoTitle` as-is (never suffixed by the template; empty → `siteName`), describes it with `seoDescription` (empty → `siteDescription`), and turns a valid `canonicalUrl` into `metadataBase` plus `alternates.canonical`, so relative Open Graph paths resolve. New helpers: `resolveSiteSeoTitle`, `resolveSiteSeoDescription`, `validateCanonicalUrl` and `normalizeCanonicalUrl`.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [fd17765]
12
+ - @reblu/site-contracts@1.12.0
13
+
3
14
  ## 1.18.0
4
15
 
5
16
  ### Minor Changes
package/README.md CHANGED
@@ -682,6 +682,43 @@ yet. Need the string only? `resolveSeoTitle({ seoTitle, title, sectionLabel },
682
682
  { template: config.seoTitleTemplate, siteName: config.siteName })`.
683
683
  Description/Open Graph are intentionally minimal here (REB-823 extends them).
684
684
 
685
+ ### Home page and canonical URL — `buildMetadata({ config, home: true })` (REB-651)
686
+
687
+ The site has its own search title and description in nexus (Ajustes → SEO y
688
+ Redes), separate from `siteName`/`siteDescription`, which stay the identity
689
+ used in breadcrumbs and chrome. `GET /api/site/config` serves them as
690
+ `seoTitle`, `seoDescription` and `canonicalUrl` (all `null` when unset).
691
+
692
+ ```ts
693
+ // app/page.tsx — the home page: no hardcoded title, description or domain
694
+ import type { Metadata } from 'next'
695
+ import { buildMetadata } from '@reblu/site-next/seo'
696
+
697
+ export async function generateMetadata(): Promise<Metadata> {
698
+ return buildMetadata({ config: await reblu.config.get(), home: true })
699
+ }
700
+
701
+ // app/layout.tsx — every route resolves relative Open Graph paths against it
702
+ import { normalizeCanonicalUrl } from '@reblu/site-next/seo'
703
+
704
+ export async function generateMetadata(): Promise<Metadata> {
705
+ const config = await reblu.config.get()
706
+ const siteUrl = normalizeCanonicalUrl(config.canonicalUrl) ?? process.env.NEXT_PUBLIC_SITE_URL!
707
+ return { metadataBase: new URL(siteUrl) /* , title, openGraph… */ }
708
+ }
709
+ ```
710
+
711
+ - `config.seoTitle`, when set, is the **whole** home title — used as-is, never
712
+ suffixed by the template. Empty → `siteName`, exactly as before.
713
+ - `config.seoDescription` falls back to `siteDescription`.
714
+ - A valid `config.canonicalUrl` (an `https` origin) becomes `metadataBase`
715
+ plus `alternates.canonical: '/'`, so an `ogImageUrl` given as a relative
716
+ path resolves against the site's domain. The env var becomes a fallback.
717
+
718
+ `home: true` is explicit: a route whose title happens to be empty never picks
719
+ up the site's SEO title. Need the strings only? `resolveSiteSeoTitle(config)`
720
+ and `resolveSiteSeoDescription(config)`.
721
+
685
722
  ## Structured data (JSON-LD)
686
723
 
687
724
  `@reblu/site-next/json-ld` (REB-622, server-only, dependency-free) renders one
package/dist/seo.cjs CHANGED
@@ -26,8 +26,12 @@ __export(seo_exports, {
26
26
  SEO_TITLE_RECOMMENDED_MAX_LENGTH: () => SEO_TITLE_RECOMMENDED_MAX_LENGTH,
27
27
  SEO_TITLE_TEMPLATE_MAX_LENGTH: () => SEO_TITLE_TEMPLATE_MAX_LENGTH,
28
28
  buildMetadata: () => buildMetadata,
29
+ normalizeCanonicalUrl: () => normalizeCanonicalUrl,
29
30
  resolveSeoTitle: () => resolveSeoTitle,
30
31
  resolveSeoTitleTemplate: () => resolveSeoTitleTemplate,
32
+ resolveSiteSeoDescription: () => resolveSiteSeoDescription,
33
+ resolveSiteSeoTitle: () => resolveSiteSeoTitle,
34
+ validateCanonicalUrl: () => validateCanonicalUrl,
31
35
  validateSeoTitleTemplate: () => validateSeoTitleTemplate
32
36
  });
33
37
  module.exports = __toCommonJS(seo_exports);
@@ -75,7 +79,34 @@ function resolveSeoTitle(input, context) {
75
79
  const brand = (part) => part.split(SEO_SITE_NAME_PLACEHOLDER).join(siteName);
76
80
  return `${brand(before)}${display}${brand(after)}`.trim();
77
81
  }
82
+ function validateCanonicalUrl(value) {
83
+ const trimmed = value.trim();
84
+ let url;
85
+ try {
86
+ url = new URL(trimmed);
87
+ } catch {
88
+ return "invalid";
89
+ }
90
+ if (url.protocol !== "https:") return "not_https";
91
+ if (url.username || url.password || url.search || url.hash || /[?#]/.test(trimmed)) {
92
+ return "not_origin";
93
+ }
94
+ if (url.pathname.replace(/\/+$/, "") !== "") return "not_origin";
95
+ return null;
96
+ }
97
+ function normalizeCanonicalUrl(value) {
98
+ const trimmed = value?.trim();
99
+ if (!trimmed || validateCanonicalUrl(trimmed) !== null) return null;
100
+ return new URL(trimmed).origin;
101
+ }
102
+ function resolveSiteSeoTitle(config) {
103
+ return config.seoTitle?.trim() || config.siteName?.trim() || "";
104
+ }
105
+ function resolveSiteSeoDescription(config) {
106
+ return config.seoDescription?.trim() || config.siteDescription?.trim() || "";
107
+ }
78
108
  function buildMetadata(input) {
109
+ if (input.home) return buildSiteMetadata(input);
79
110
  const title = input.seo?.title?.trim() || resolveSeoTitle(input, {
80
111
  template: input.config.seoTitleTemplate,
81
112
  siteName: input.config.siteName
@@ -86,6 +117,17 @@ function buildMetadata(input) {
86
117
  if (description) metadata.description = description;
87
118
  return metadata;
88
119
  }
120
+ function buildSiteMetadata(input) {
121
+ const metadata = {};
122
+ const canonicalUrl = normalizeCanonicalUrl(input.config.canonicalUrl);
123
+ if (canonicalUrl) metadata.metadataBase = new URL(canonicalUrl);
124
+ const title = resolveSiteSeoTitle(input.config);
125
+ if (title) metadata.title = { absolute: title };
126
+ const description = input.description?.trim() || resolveSiteSeoDescription(input.config);
127
+ if (description) metadata.description = description;
128
+ if (canonicalUrl) metadata.alternates = { canonical: "/" };
129
+ return metadata;
130
+ }
89
131
  // Annotate the CommonJS export names for ESM import in node:
90
132
  0 && (module.exports = {
91
133
  DEFAULT_SEO_TITLE_TEMPLATE,
@@ -94,8 +136,12 @@ function buildMetadata(input) {
94
136
  SEO_TITLE_RECOMMENDED_MAX_LENGTH,
95
137
  SEO_TITLE_TEMPLATE_MAX_LENGTH,
96
138
  buildMetadata,
139
+ normalizeCanonicalUrl,
97
140
  resolveSeoTitle,
98
141
  resolveSeoTitleTemplate,
142
+ resolveSiteSeoDescription,
143
+ resolveSiteSeoTitle,
144
+ validateCanonicalUrl,
99
145
  validateSeoTitleTemplate
100
146
  });
101
147
  //# sourceMappingURL=seo.cjs.map
package/dist/seo.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/seo.ts"],"sourcesContent":["/**\n * `@reblu/site-next/seo` — the ONE page-title rule (REB-871), shared by the\n * Reblu SITE API (which serves `seo.title` already resolved on every detail\n * endpoint) and by SITEs (index/list routes, or an older API without `seo`).\n *\n * The rule, in order:\n * 1. An entity SEO title (`seoTitle` / `metaTitle`) that is non-empty after\n * trimming is the WHOLE title — used as-is, never suffixed.\n * 2. Otherwise the tenant template (`SiteSettings.seoTitleTemplate`, default\n * `%s | {siteName}`) is applied ONCE to the display title — the entity\n * title on a detail route, the section label on a list/index route.\n * 3. The brand is never duplicated: a display title that already names the\n * site is used alone, and a site with no name drops the brand part.\n *\n * Own tsup entry with ZERO runtime dependencies (no React, no `next` — only\n * the `Metadata` TYPE) so base-api can import it server-side and a SITE can\n * call it from `generateMetadata` with no RSC-boundary cost. It must never\n * carry `'use client'`.\n */\nimport type { Metadata } from 'next'\n\n/** Applied when the tenant never chose a template (`seoTitleTemplate` NULL). */\nexport const DEFAULT_SEO_TITLE_TEMPLATE = '%s | {siteName}'\n/** The display-title placeholder — must appear exactly once in a template. */\nexport const SEO_TITLE_PLACEHOLDER = '%s'\n/** Optional brand placeholder, replaced by `siteName`. */\nexport const SEO_SITE_NAME_PLACEHOLDER = '{siteName}'\n/** Upper bound for a stored template (write-side validation). */\nexport const SEO_TITLE_TEMPLATE_MAX_LENGTH = 60\n/** Recommended length of a full page title in search results. */\nexport const SEO_TITLE_RECOMMENDED_MAX_LENGTH = 60\n\nexport type SeoTitleTemplateIssue = 'missing_placeholder' | 'multiple_placeholders' | 'too_long'\n\n/** `null` when `template` is a valid title template, otherwise why it is not. */\nexport function validateSeoTitleTemplate(template: string): SeoTitleTemplateIssue | null {\n const occurrences = template.split(SEO_TITLE_PLACEHOLDER).length - 1\n if (occurrences === 0) return 'missing_placeholder'\n if (occurrences > 1) return 'multiple_placeholders'\n if (template.length > SEO_TITLE_TEMPLATE_MAX_LENGTH) return 'too_long'\n return null\n}\n\n/**\n * The template to apply: the stored one (trimmed) when valid, otherwise the\n * default. An invalid stored value (hand-edited row) degrades to the default\n * instead of producing a broken title.\n */\nexport function resolveSeoTitleTemplate(template: string | null | undefined): string {\n const trimmed = template?.trim() ?? ''\n if (trimmed && validateSeoTitleTemplate(trimmed) === null) return trimmed\n return DEFAULT_SEO_TITLE_TEMPLATE\n}\n\nexport interface SeoTitleInput {\n /** Entity SEO title (`seoTitle` on pages, `metaTitle` on posts/products/courses). */\n seoTitle?: string | null\n /** Display title of the entity (detail routes). */\n title?: string | null\n /** Label of a list/index route (e.g. \"Blog\"), used when there is no entity title. */\n sectionLabel?: string | null\n}\n\nexport interface SeoTitleContext {\n /** `Config.seoTitleTemplate` — null/undefined/invalid → the default. */\n template?: string | null\n /** `Config.siteName`. */\n siteName?: string | null\n}\n\n/** A letter, digit or combining mark — accents included (Unicode-aware). */\nconst WORD_CHAR_AT_END = /[\\p{L}\\p{N}\\p{M}]$/u\nconst WORD_CHAR_AT_START = /^[\\p{L}\\p{N}\\p{M}]/u\n\n/**\n * Whether `phrase` occurs in `text` as a whole word/phrase (case-insensitive):\n * the brand \"Arte\" is in \"Galería Arte\" but not in \"Cartera\" or \"Artesanía\".\n */\nfunction containsPhrase(text: string, phrase: string): boolean {\n const haystack = text.toLocaleLowerCase()\n const needle = phrase.toLocaleLowerCase()\n for (let i = haystack.indexOf(needle); i !== -1; i = haystack.indexOf(needle, i + 1)) {\n const before = haystack.slice(0, i)\n const after = haystack.slice(i + needle.length)\n if (!WORD_CHAR_AT_END.test(before) && !WORD_CHAR_AT_START.test(after)) return true\n }\n return false\n}\n\nexport function resolveSeoTitle(input: SeoTitleInput, context: SeoTitleContext): string {\n const asIs = input.seoTitle?.trim()\n if (asIs) return asIs\n\n const siteName = context.siteName?.trim() ?? ''\n const display = input.title?.trim() || input.sectionLabel?.trim() || ''\n if (!display) return siteName\n\n const template = resolveSeoTitleTemplate(context.template)\n if (template.includes(SEO_SITE_NAME_PLACEHOLDER)) {\n if (!siteName) return display\n if (containsPhrase(display, siteName)) return display\n }\n\n // Split on the placeholder BEFORE inserting the display title, so the title\n // itself is never scanned for placeholders (applied exactly once) and no\n // `String.replace` special pattern (`$&`, `$1`) can reach it.\n const [before = '', after = ''] = template.split(SEO_TITLE_PLACEHOLDER)\n const brand = (part: string) => part.split(SEO_SITE_NAME_PLACEHOLDER).join(siteName)\n return `${brand(before)}${display}${brand(after)}`.trim()\n}\n\nexport interface BuildMetadataInput extends SeoTitleInput {\n /** The detail endpoint's `seo` block — its `title` is already resolved. */\n seo?: { title?: string | null } | null\n /** `GET /api/site/config` (or the subset needed here). */\n config: { siteName?: string | null; seoTitleTemplate?: string | null }\n description?: string | null\n}\n\n/**\n * Next `Metadata` for a SITE route. The title is emitted as `absolute` so a\n * root-layout `title.template` can never append the brand a second time.\n * Description/Open Graph are deliberately minimal here (REB-823 extends them).\n */\nexport function buildMetadata(input: BuildMetadataInput): Metadata {\n const title =\n input.seo?.title?.trim() ||\n resolveSeoTitle(input, {\n template: input.config.seoTitleTemplate,\n siteName: input.config.siteName,\n })\n\n const metadata: Metadata = {}\n if (title) metadata.title = { absolute: title }\n const description = input.description?.trim()\n if (description) metadata.description = description\n return metadata\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBO,IAAM,6BAA6B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,QAAQ,EAAG,QAAO;AAAA,EAChD;AAKA,QAAM,CAAC,SAAS,IAAI,QAAQ,EAAE,IAAI,SAAS,MAAM,qBAAqB;AACtE,QAAM,QAAQ,CAAC,SAAiB,KAAK,MAAM,yBAAyB,EAAE,KAAK,QAAQ;AACnF,SAAO,GAAG,MAAM,MAAM,CAAC,GAAG,OAAO,GAAG,MAAM,KAAK,CAAC,GAAG,KAAK;AAC1D;AAeO,SAAS,cAAc,OAAqC;AACjE,QAAM,QACJ,MAAM,KAAK,OAAO,KAAK,KACvB,gBAAgB,OAAO;AAAA,IACrB,UAAU,MAAM,OAAO;AAAA,IACvB,UAAU,MAAM,OAAO;AAAA,EACzB,CAAC;AAEH,QAAM,WAAqB,CAAC;AAC5B,MAAI,MAAO,UAAS,QAAQ,EAAE,UAAU,MAAM;AAC9C,QAAM,cAAc,MAAM,aAAa,KAAK;AAC5C,MAAI,YAAa,UAAS,cAAc;AACxC,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/seo.ts"],"sourcesContent":["/**\n * `@reblu/site-next/seo` — the ONE page-title rule (REB-871), shared by the\n * Reblu SITE API (which serves `seo.title` already resolved on every detail\n * endpoint) and by SITEs (index/list routes, or an older API without `seo`).\n *\n * The rule, in order:\n * 1. An entity SEO title (`seoTitle` / `metaTitle`) that is non-empty after\n * trimming is the WHOLE title — used as-is, never suffixed.\n * 2. Otherwise the tenant template (`SiteSettings.seoTitleTemplate`, default\n * `%s | {siteName}`) is applied ONCE to the display title — the entity\n * title on a detail route, the section label on a list/index route.\n * 3. The brand is never duplicated: a display title that already names the\n * site is used alone, and a site with no name drops the brand part.\n *\n * Own tsup entry with ZERO runtime dependencies (no React, no `next` — only\n * the `Metadata` TYPE) so base-api can import it server-side and a SITE can\n * call it from `generateMetadata` with no RSC-boundary cost. It must never\n * carry `'use client'`.\n */\nimport type { Metadata } from 'next'\n\n/** Applied when the tenant never chose a template (`seoTitleTemplate` NULL). */\nexport const DEFAULT_SEO_TITLE_TEMPLATE = '%s | {siteName}'\n/** The display-title placeholder — must appear exactly once in a template. */\nexport const SEO_TITLE_PLACEHOLDER = '%s'\n/** Optional brand placeholder, replaced by `siteName`. */\nexport const SEO_SITE_NAME_PLACEHOLDER = '{siteName}'\n/** Upper bound for a stored template (write-side validation). */\nexport const SEO_TITLE_TEMPLATE_MAX_LENGTH = 60\n/** Recommended length of a full page title in search results. */\nexport const SEO_TITLE_RECOMMENDED_MAX_LENGTH = 60\n\nexport type SeoTitleTemplateIssue = 'missing_placeholder' | 'multiple_placeholders' | 'too_long'\n\n/** `null` when `template` is a valid title template, otherwise why it is not. */\nexport function validateSeoTitleTemplate(template: string): SeoTitleTemplateIssue | null {\n const occurrences = template.split(SEO_TITLE_PLACEHOLDER).length - 1\n if (occurrences === 0) return 'missing_placeholder'\n if (occurrences > 1) return 'multiple_placeholders'\n if (template.length > SEO_TITLE_TEMPLATE_MAX_LENGTH) return 'too_long'\n return null\n}\n\n/**\n * The template to apply: the stored one (trimmed) when valid, otherwise the\n * default. An invalid stored value (hand-edited row) degrades to the default\n * instead of producing a broken title.\n */\nexport function resolveSeoTitleTemplate(template: string | null | undefined): string {\n const trimmed = template?.trim() ?? ''\n if (trimmed && validateSeoTitleTemplate(trimmed) === null) return trimmed\n return DEFAULT_SEO_TITLE_TEMPLATE\n}\n\nexport interface SeoTitleInput {\n /** Entity SEO title (`seoTitle` on pages, `metaTitle` on posts/products/courses). */\n seoTitle?: string | null\n /** Display title of the entity (detail routes). */\n title?: string | null\n /** Label of a list/index route (e.g. \"Blog\"), used when there is no entity title. */\n sectionLabel?: string | null\n}\n\nexport interface SeoTitleContext {\n /** `Config.seoTitleTemplate` — null/undefined/invalid → the default. */\n template?: string | null\n /** `Config.siteName`. */\n siteName?: string | null\n}\n\n/** A letter, digit or combining mark — accents included (Unicode-aware). */\nconst WORD_CHAR_AT_END = /[\\p{L}\\p{N}\\p{M}]$/u\nconst WORD_CHAR_AT_START = /^[\\p{L}\\p{N}\\p{M}]/u\n\n/**\n * Whether `phrase` occurs in `text` as a whole word/phrase (case-insensitive):\n * the brand \"Arte\" is in \"Galería Arte\" but not in \"Cartera\" or \"Artesanía\".\n */\nfunction containsPhrase(text: string, phrase: string): boolean {\n const haystack = text.toLocaleLowerCase()\n const needle = phrase.toLocaleLowerCase()\n for (let i = haystack.indexOf(needle); i !== -1; i = haystack.indexOf(needle, i + 1)) {\n const before = haystack.slice(0, i)\n const after = haystack.slice(i + needle.length)\n if (!WORD_CHAR_AT_END.test(before) && !WORD_CHAR_AT_START.test(after)) return true\n }\n return false\n}\n\nexport function resolveSeoTitle(input: SeoTitleInput, context: SeoTitleContext): string {\n const asIs = input.seoTitle?.trim()\n if (asIs) return asIs\n\n const siteName = context.siteName?.trim() ?? ''\n const display = input.title?.trim() || input.sectionLabel?.trim() || ''\n if (!display) return siteName\n\n const template = resolveSeoTitleTemplate(context.template)\n if (template.includes(SEO_SITE_NAME_PLACEHOLDER)) {\n if (!siteName) return display\n if (containsPhrase(display, siteName)) return display\n }\n\n // Split on the placeholder BEFORE inserting the display title, so the title\n // itself is never scanned for placeholders (applied exactly once) and no\n // `String.replace` special pattern (`$&`, `$1`) can reach it.\n const [before = '', after = ''] = template.split(SEO_TITLE_PLACEHOLDER)\n const brand = (part: string) => part.split(SEO_SITE_NAME_PLACEHOLDER).join(siteName)\n return `${brand(before)}${display}${brand(after)}`.trim()\n}\n\nexport type CanonicalUrlIssue = 'invalid' | 'not_https' | 'not_origin'\n\n/**\n * REB-651 — `null` when `value` is a valid canonical site URL: an absolute\n * `https` origin, with nothing after the host but optional trailing slashes\n * (no path, query, fragment or credentials). Otherwise why it is not.\n */\nexport function validateCanonicalUrl(value: string): CanonicalUrlIssue | null {\n const trimmed = value.trim()\n let url: URL\n try {\n url = new URL(trimmed)\n } catch {\n return 'invalid'\n }\n if (url.protocol !== 'https:') return 'not_https'\n // `?` / `#` with nothing after them parse to an empty search/hash, so the\n // raw string is checked as well: a bare `?` is still not an origin.\n if (url.username || url.password || url.search || url.hash || /[?#]/.test(trimmed)) {\n return 'not_origin'\n }\n if (url.pathname.replace(/\\/+$/, '') !== '') return 'not_origin'\n return null\n}\n\n/**\n * The stored/served form of a canonical site URL: the origin with no trailing\n * slash (`https://example.com`), host lower-cased and default port dropped.\n * `null` when unset or invalid — a hand-edited row never yields a broken\n * `metadataBase`.\n */\nexport function normalizeCanonicalUrl(value: string | null | undefined): string | null {\n const trimmed = value?.trim()\n if (!trimmed || validateCanonicalUrl(trimmed) !== null) return null\n return new URL(trimmed).origin\n}\n\n/** The site-level SEO fields of `GET /api/site/config` (REB-651). */\nexport interface SiteSeoConfig {\n siteName?: string | null\n siteDescription?: string | null\n /** `Config.seoTitle` — the site's own search title. */\n seoTitle?: string | null\n /** `Config.seoDescription` — the site's own search description. */\n seoDescription?: string | null\n /** `Config.canonicalUrl` — the site origin, fed to `metadataBase`. */\n canonicalUrl?: string | null\n}\n\n/**\n * The home page title (REB-651): a non-empty site `seoTitle` is used as-is —\n * never suffixed by the template, the same rule as an entity SEO title —\n * otherwise `siteName`, exactly as before the field existed.\n */\nexport function resolveSiteSeoTitle(config: SiteSeoConfig): string {\n return config.seoTitle?.trim() || config.siteName?.trim() || ''\n}\n\n/** The home page description: `seoDescription`, else `siteDescription`. */\nexport function resolveSiteSeoDescription(config: SiteSeoConfig): string {\n return config.seoDescription?.trim() || config.siteDescription?.trim() || ''\n}\n\nexport interface BuildMetadataInput extends SeoTitleInput {\n /** The detail endpoint's `seo` block — its `title` is already resolved. */\n seo?: { title?: string | null } | null\n /** `GET /api/site/config` (or the subset needed here). */\n config: { seoTitleTemplate?: string | null } & SiteSeoConfig\n description?: string | null\n /**\n * REB-651 — the home / site-level path: the title is the site `seoTitle`\n * as-is (else `siteName`), the description the site `seoDescription` (else\n * `siteDescription`), and a valid `canonicalUrl` becomes `metadataBase`.\n * Explicit on purpose: a page whose title happens to be empty must never be\n * titled with the site's SEO title.\n */\n home?: boolean\n}\n\n/**\n * Next `Metadata` for a SITE route. The title is emitted as `absolute` so a\n * root-layout `title.template` can never append the brand a second time.\n * Description/Open Graph are deliberately minimal here (REB-823 extends them).\n */\nexport function buildMetadata(input: BuildMetadataInput): Metadata {\n if (input.home) return buildSiteMetadata(input)\n\n const title =\n input.seo?.title?.trim() ||\n resolveSeoTitle(input, {\n template: input.config.seoTitleTemplate,\n siteName: input.config.siteName,\n })\n\n const metadata: Metadata = {}\n if (title) metadata.title = { absolute: title }\n const description = input.description?.trim()\n if (description) metadata.description = description\n return metadata\n}\n\nfunction buildSiteMetadata(input: BuildMetadataInput): Metadata {\n const metadata: Metadata = {}\n const canonicalUrl = normalizeCanonicalUrl(input.config.canonicalUrl)\n if (canonicalUrl) metadata.metadataBase = new URL(canonicalUrl)\n\n const title = resolveSiteSeoTitle(input.config)\n if (title) metadata.title = { absolute: title }\n const description = input.description?.trim() || resolveSiteSeoDescription(input.config)\n if (description) metadata.description = description\n\n if (canonicalUrl) metadata.alternates = { canonical: '/' }\n return metadata\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBO,IAAM,6BAA6B;AAEnC,IAAM,wBAAwB;AAE9B,IAAM,4BAA4B;AAElC,IAAM,gCAAgC;AAEtC,IAAM,mCAAmC;AAKzC,SAAS,yBAAyB,UAAgD;AACvF,QAAM,cAAc,SAAS,MAAM,qBAAqB,EAAE,SAAS;AACnE,MAAI,gBAAgB,EAAG,QAAO;AAC9B,MAAI,cAAc,EAAG,QAAO;AAC5B,MAAI,SAAS,SAAS,8BAA+B,QAAO;AAC5D,SAAO;AACT;AAOO,SAAS,wBAAwB,UAA6C;AACnF,QAAM,UAAU,UAAU,KAAK,KAAK;AACpC,MAAI,WAAW,yBAAyB,OAAO,MAAM,KAAM,QAAO;AAClE,SAAO;AACT;AAmBA,IAAM,mBAAmB;AACzB,IAAM,qBAAqB;AAM3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,cAAc;AAExC,MAAI,aAAc,UAAS,aAAa,EAAE,WAAW,IAAI;AACzD,SAAO;AACT;","names":[]}
package/dist/seo.d.cts CHANGED
@@ -54,6 +54,39 @@ interface SeoTitleContext {
54
54
  siteName?: string | null;
55
55
  }
56
56
  declare function resolveSeoTitle(input: SeoTitleInput, context: SeoTitleContext): string;
57
+ type CanonicalUrlIssue = 'invalid' | 'not_https' | 'not_origin';
58
+ /**
59
+ * REB-651 — `null` when `value` is a valid canonical site URL: an absolute
60
+ * `https` origin, with nothing after the host but optional trailing slashes
61
+ * (no path, query, fragment or credentials). Otherwise why it is not.
62
+ */
63
+ declare function validateCanonicalUrl(value: string): CanonicalUrlIssue | null;
64
+ /**
65
+ * The stored/served form of a canonical site URL: the origin with no trailing
66
+ * slash (`https://example.com`), host lower-cased and default port dropped.
67
+ * `null` when unset or invalid — a hand-edited row never yields a broken
68
+ * `metadataBase`.
69
+ */
70
+ declare function normalizeCanonicalUrl(value: string | null | undefined): string | null;
71
+ /** The site-level SEO fields of `GET /api/site/config` (REB-651). */
72
+ interface SiteSeoConfig {
73
+ siteName?: string | null;
74
+ siteDescription?: string | null;
75
+ /** `Config.seoTitle` — the site's own search title. */
76
+ seoTitle?: string | null;
77
+ /** `Config.seoDescription` — the site's own search description. */
78
+ seoDescription?: string | null;
79
+ /** `Config.canonicalUrl` — the site origin, fed to `metadataBase`. */
80
+ canonicalUrl?: string | null;
81
+ }
82
+ /**
83
+ * The home page title (REB-651): a non-empty site `seoTitle` is used as-is —
84
+ * never suffixed by the template, the same rule as an entity SEO title —
85
+ * otherwise `siteName`, exactly as before the field existed.
86
+ */
87
+ declare function resolveSiteSeoTitle(config: SiteSeoConfig): string;
88
+ /** The home page description: `seoDescription`, else `siteDescription`. */
89
+ declare function resolveSiteSeoDescription(config: SiteSeoConfig): string;
57
90
  interface BuildMetadataInput extends SeoTitleInput {
58
91
  /** The detail endpoint's `seo` block — its `title` is already resolved. */
59
92
  seo?: {
@@ -61,10 +94,17 @@ interface BuildMetadataInput extends SeoTitleInput {
61
94
  } | null;
62
95
  /** `GET /api/site/config` (or the subset needed here). */
63
96
  config: {
64
- siteName?: string | null;
65
97
  seoTitleTemplate?: string | null;
66
- };
98
+ } & SiteSeoConfig;
67
99
  description?: string | null;
100
+ /**
101
+ * REB-651 — the home / site-level path: the title is the site `seoTitle`
102
+ * as-is (else `siteName`), the description the site `seoDescription` (else
103
+ * `siteDescription`), and a valid `canonicalUrl` becomes `metadataBase`.
104
+ * Explicit on purpose: a page whose title happens to be empty must never be
105
+ * titled with the site's SEO title.
106
+ */
107
+ home?: boolean;
68
108
  }
69
109
  /**
70
110
  * Next `Metadata` for a SITE route. The title is emitted as `absolute` so a
@@ -73,4 +113,4 @@ interface BuildMetadataInput extends SeoTitleInput {
73
113
  */
74
114
  declare function buildMetadata(input: BuildMetadataInput): Metadata;
75
115
 
76
- export { type BuildMetadataInput, DEFAULT_SEO_TITLE_TEMPLATE, SEO_SITE_NAME_PLACEHOLDER, SEO_TITLE_PLACEHOLDER, SEO_TITLE_RECOMMENDED_MAX_LENGTH, SEO_TITLE_TEMPLATE_MAX_LENGTH, type SeoTitleContext, type SeoTitleInput, type SeoTitleTemplateIssue, buildMetadata, resolveSeoTitle, resolveSeoTitleTemplate, validateSeoTitleTemplate };
116
+ export { type BuildMetadataInput, type CanonicalUrlIssue, DEFAULT_SEO_TITLE_TEMPLATE, SEO_SITE_NAME_PLACEHOLDER, SEO_TITLE_PLACEHOLDER, SEO_TITLE_RECOMMENDED_MAX_LENGTH, SEO_TITLE_TEMPLATE_MAX_LENGTH, type SeoTitleContext, type SeoTitleInput, type SeoTitleTemplateIssue, type SiteSeoConfig, buildMetadata, normalizeCanonicalUrl, resolveSeoTitle, resolveSeoTitleTemplate, resolveSiteSeoDescription, resolveSiteSeoTitle, validateCanonicalUrl, validateSeoTitleTemplate };
package/dist/seo.d.ts CHANGED
@@ -54,6 +54,39 @@ interface SeoTitleContext {
54
54
  siteName?: string | null;
55
55
  }
56
56
  declare function resolveSeoTitle(input: SeoTitleInput, context: SeoTitleContext): string;
57
+ type CanonicalUrlIssue = 'invalid' | 'not_https' | 'not_origin';
58
+ /**
59
+ * REB-651 — `null` when `value` is a valid canonical site URL: an absolute
60
+ * `https` origin, with nothing after the host but optional trailing slashes
61
+ * (no path, query, fragment or credentials). Otherwise why it is not.
62
+ */
63
+ declare function validateCanonicalUrl(value: string): CanonicalUrlIssue | null;
64
+ /**
65
+ * The stored/served form of a canonical site URL: the origin with no trailing
66
+ * slash (`https://example.com`), host lower-cased and default port dropped.
67
+ * `null` when unset or invalid — a hand-edited row never yields a broken
68
+ * `metadataBase`.
69
+ */
70
+ declare function normalizeCanonicalUrl(value: string | null | undefined): string | null;
71
+ /** The site-level SEO fields of `GET /api/site/config` (REB-651). */
72
+ interface SiteSeoConfig {
73
+ siteName?: string | null;
74
+ siteDescription?: string | null;
75
+ /** `Config.seoTitle` — the site's own search title. */
76
+ seoTitle?: string | null;
77
+ /** `Config.seoDescription` — the site's own search description. */
78
+ seoDescription?: string | null;
79
+ /** `Config.canonicalUrl` — the site origin, fed to `metadataBase`. */
80
+ canonicalUrl?: string | null;
81
+ }
82
+ /**
83
+ * The home page title (REB-651): a non-empty site `seoTitle` is used as-is —
84
+ * never suffixed by the template, the same rule as an entity SEO title —
85
+ * otherwise `siteName`, exactly as before the field existed.
86
+ */
87
+ declare function resolveSiteSeoTitle(config: SiteSeoConfig): string;
88
+ /** The home page description: `seoDescription`, else `siteDescription`. */
89
+ declare function resolveSiteSeoDescription(config: SiteSeoConfig): string;
57
90
  interface BuildMetadataInput extends SeoTitleInput {
58
91
  /** The detail endpoint's `seo` block — its `title` is already resolved. */
59
92
  seo?: {
@@ -61,10 +94,17 @@ interface BuildMetadataInput extends SeoTitleInput {
61
94
  } | null;
62
95
  /** `GET /api/site/config` (or the subset needed here). */
63
96
  config: {
64
- siteName?: string | null;
65
97
  seoTitleTemplate?: string | null;
66
- };
98
+ } & SiteSeoConfig;
67
99
  description?: string | null;
100
+ /**
101
+ * REB-651 — the home / site-level path: the title is the site `seoTitle`
102
+ * as-is (else `siteName`), the description the site `seoDescription` (else
103
+ * `siteDescription`), and a valid `canonicalUrl` becomes `metadataBase`.
104
+ * Explicit on purpose: a page whose title happens to be empty must never be
105
+ * titled with the site's SEO title.
106
+ */
107
+ home?: boolean;
68
108
  }
69
109
  /**
70
110
  * Next `Metadata` for a SITE route. The title is emitted as `absolute` so a
@@ -73,4 +113,4 @@ interface BuildMetadataInput extends SeoTitleInput {
73
113
  */
74
114
  declare function buildMetadata(input: BuildMetadataInput): Metadata;
75
115
 
76
- export { type BuildMetadataInput, DEFAULT_SEO_TITLE_TEMPLATE, SEO_SITE_NAME_PLACEHOLDER, SEO_TITLE_PLACEHOLDER, SEO_TITLE_RECOMMENDED_MAX_LENGTH, SEO_TITLE_TEMPLATE_MAX_LENGTH, type SeoTitleContext, type SeoTitleInput, type SeoTitleTemplateIssue, buildMetadata, resolveSeoTitle, resolveSeoTitleTemplate, validateSeoTitleTemplate };
116
+ export { type BuildMetadataInput, type CanonicalUrlIssue, DEFAULT_SEO_TITLE_TEMPLATE, SEO_SITE_NAME_PLACEHOLDER, SEO_TITLE_PLACEHOLDER, SEO_TITLE_RECOMMENDED_MAX_LENGTH, SEO_TITLE_TEMPLATE_MAX_LENGTH, type SeoTitleContext, type SeoTitleInput, type SeoTitleTemplateIssue, type SiteSeoConfig, buildMetadata, normalizeCanonicalUrl, resolveSeoTitle, resolveSeoTitleTemplate, resolveSiteSeoDescription, resolveSiteSeoTitle, validateCanonicalUrl, validateSeoTitleTemplate };
package/dist/seo.js CHANGED
@@ -43,7 +43,34 @@ function resolveSeoTitle(input, context) {
43
43
  const brand = (part) => part.split(SEO_SITE_NAME_PLACEHOLDER).join(siteName);
44
44
  return `${brand(before)}${display}${brand(after)}`.trim();
45
45
  }
46
+ function validateCanonicalUrl(value) {
47
+ const trimmed = value.trim();
48
+ let url;
49
+ try {
50
+ url = new URL(trimmed);
51
+ } catch {
52
+ return "invalid";
53
+ }
54
+ if (url.protocol !== "https:") return "not_https";
55
+ if (url.username || url.password || url.search || url.hash || /[?#]/.test(trimmed)) {
56
+ return "not_origin";
57
+ }
58
+ if (url.pathname.replace(/\/+$/, "") !== "") return "not_origin";
59
+ return null;
60
+ }
61
+ function normalizeCanonicalUrl(value) {
62
+ const trimmed = value?.trim();
63
+ if (!trimmed || validateCanonicalUrl(trimmed) !== null) return null;
64
+ return new URL(trimmed).origin;
65
+ }
66
+ function resolveSiteSeoTitle(config) {
67
+ return config.seoTitle?.trim() || config.siteName?.trim() || "";
68
+ }
69
+ function resolveSiteSeoDescription(config) {
70
+ return config.seoDescription?.trim() || config.siteDescription?.trim() || "";
71
+ }
46
72
  function buildMetadata(input) {
73
+ if (input.home) return buildSiteMetadata(input);
47
74
  const title = input.seo?.title?.trim() || resolveSeoTitle(input, {
48
75
  template: input.config.seoTitleTemplate,
49
76
  siteName: input.config.siteName
@@ -54,6 +81,17 @@ function buildMetadata(input) {
54
81
  if (description) metadata.description = description;
55
82
  return metadata;
56
83
  }
84
+ function buildSiteMetadata(input) {
85
+ const metadata = {};
86
+ const canonicalUrl = normalizeCanonicalUrl(input.config.canonicalUrl);
87
+ if (canonicalUrl) metadata.metadataBase = new URL(canonicalUrl);
88
+ const title = resolveSiteSeoTitle(input.config);
89
+ if (title) metadata.title = { absolute: title };
90
+ const description = input.description?.trim() || resolveSiteSeoDescription(input.config);
91
+ if (description) metadata.description = description;
92
+ if (canonicalUrl) metadata.alternates = { canonical: "/" };
93
+ return metadata;
94
+ }
57
95
  export {
58
96
  DEFAULT_SEO_TITLE_TEMPLATE,
59
97
  SEO_SITE_NAME_PLACEHOLDER,
@@ -61,8 +99,12 @@ export {
61
99
  SEO_TITLE_RECOMMENDED_MAX_LENGTH,
62
100
  SEO_TITLE_TEMPLATE_MAX_LENGTH,
63
101
  buildMetadata,
102
+ normalizeCanonicalUrl,
64
103
  resolveSeoTitle,
65
104
  resolveSeoTitleTemplate,
105
+ resolveSiteSeoDescription,
106
+ resolveSiteSeoTitle,
107
+ validateCanonicalUrl,
66
108
  validateSeoTitleTemplate
67
109
  };
68
110
  //# sourceMappingURL=seo.js.map
package/dist/seo.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/seo.ts"],"sourcesContent":["/**\n * `@reblu/site-next/seo` — the ONE page-title rule (REB-871), shared by the\n * Reblu SITE API (which serves `seo.title` already resolved on every detail\n * endpoint) and by SITEs (index/list routes, or an older API without `seo`).\n *\n * The rule, in order:\n * 1. An entity SEO title (`seoTitle` / `metaTitle`) that is non-empty after\n * trimming is the WHOLE title — used as-is, never suffixed.\n * 2. Otherwise the tenant template (`SiteSettings.seoTitleTemplate`, default\n * `%s | {siteName}`) is applied ONCE to the display title — the entity\n * title on a detail route, the section label on a list/index route.\n * 3. The brand is never duplicated: a display title that already names the\n * site is used alone, and a site with no name drops the brand part.\n *\n * Own tsup entry with ZERO runtime dependencies (no React, no `next` — only\n * the `Metadata` TYPE) so base-api can import it server-side and a SITE can\n * call it from `generateMetadata` with no RSC-boundary cost. It must never\n * carry `'use client'`.\n */\nimport type { Metadata } from 'next'\n\n/** Applied when the tenant never chose a template (`seoTitleTemplate` NULL). */\nexport const DEFAULT_SEO_TITLE_TEMPLATE = '%s | {siteName}'\n/** The display-title placeholder — must appear exactly once in a template. */\nexport const SEO_TITLE_PLACEHOLDER = '%s'\n/** Optional brand placeholder, replaced by `siteName`. */\nexport const SEO_SITE_NAME_PLACEHOLDER = '{siteName}'\n/** Upper bound for a stored template (write-side validation). */\nexport const SEO_TITLE_TEMPLATE_MAX_LENGTH = 60\n/** Recommended length of a full page title in search results. */\nexport const SEO_TITLE_RECOMMENDED_MAX_LENGTH = 60\n\nexport type SeoTitleTemplateIssue = 'missing_placeholder' | 'multiple_placeholders' | 'too_long'\n\n/** `null` when `template` is a valid title template, otherwise why it is not. */\nexport function validateSeoTitleTemplate(template: string): SeoTitleTemplateIssue | null {\n const occurrences = template.split(SEO_TITLE_PLACEHOLDER).length - 1\n if (occurrences === 0) return 'missing_placeholder'\n if (occurrences > 1) return 'multiple_placeholders'\n if (template.length > SEO_TITLE_TEMPLATE_MAX_LENGTH) return 'too_long'\n return null\n}\n\n/**\n * The template to apply: the stored one (trimmed) when valid, otherwise the\n * default. An invalid stored value (hand-edited row) degrades to the default\n * instead of producing a broken title.\n */\nexport function resolveSeoTitleTemplate(template: string | null | undefined): string {\n const trimmed = template?.trim() ?? ''\n if (trimmed && validateSeoTitleTemplate(trimmed) === null) return trimmed\n return DEFAULT_SEO_TITLE_TEMPLATE\n}\n\nexport interface SeoTitleInput {\n /** Entity SEO title (`seoTitle` on pages, `metaTitle` on posts/products/courses). */\n seoTitle?: string | null\n /** Display title of the entity (detail routes). */\n title?: string | null\n /** Label of a list/index route (e.g. \"Blog\"), used when there is no entity title. */\n sectionLabel?: string | null\n}\n\nexport interface SeoTitleContext {\n /** `Config.seoTitleTemplate` — null/undefined/invalid → the default. */\n template?: string | null\n /** `Config.siteName`. */\n siteName?: string | null\n}\n\n/** A letter, digit or combining mark — accents included (Unicode-aware). */\nconst WORD_CHAR_AT_END = /[\\p{L}\\p{N}\\p{M}]$/u\nconst WORD_CHAR_AT_START = /^[\\p{L}\\p{N}\\p{M}]/u\n\n/**\n * Whether `phrase` occurs in `text` as a whole word/phrase (case-insensitive):\n * the brand \"Arte\" is in \"Galería Arte\" but not in \"Cartera\" or \"Artesanía\".\n */\nfunction containsPhrase(text: string, phrase: string): boolean {\n const haystack = text.toLocaleLowerCase()\n const needle = phrase.toLocaleLowerCase()\n for (let i = haystack.indexOf(needle); i !== -1; i = haystack.indexOf(needle, i + 1)) {\n const before = haystack.slice(0, i)\n const after = haystack.slice(i + needle.length)\n if (!WORD_CHAR_AT_END.test(before) && !WORD_CHAR_AT_START.test(after)) return true\n }\n return false\n}\n\nexport function resolveSeoTitle(input: SeoTitleInput, context: SeoTitleContext): string {\n const asIs = input.seoTitle?.trim()\n if (asIs) return asIs\n\n const siteName = context.siteName?.trim() ?? ''\n const display = input.title?.trim() || input.sectionLabel?.trim() || ''\n if (!display) return siteName\n\n const template = resolveSeoTitleTemplate(context.template)\n if (template.includes(SEO_SITE_NAME_PLACEHOLDER)) {\n if (!siteName) return display\n if (containsPhrase(display, siteName)) return display\n }\n\n // Split on the placeholder BEFORE inserting the display title, so the title\n // itself is never scanned for placeholders (applied exactly once) and no\n // `String.replace` special pattern (`$&`, `$1`) can reach it.\n const [before = '', after = ''] = template.split(SEO_TITLE_PLACEHOLDER)\n const brand = (part: string) => part.split(SEO_SITE_NAME_PLACEHOLDER).join(siteName)\n return `${brand(before)}${display}${brand(after)}`.trim()\n}\n\nexport interface BuildMetadataInput extends SeoTitleInput {\n /** The detail endpoint's `seo` block — its `title` is already resolved. */\n seo?: { title?: string | null } | null\n /** `GET /api/site/config` (or the subset needed here). */\n config: { siteName?: string | null; seoTitleTemplate?: string | null }\n description?: string | null\n}\n\n/**\n * Next `Metadata` for a SITE route. The title is emitted as `absolute` so a\n * root-layout `title.template` can never append the brand a second time.\n * Description/Open Graph are deliberately minimal here (REB-823 extends them).\n */\nexport function buildMetadata(input: BuildMetadataInput): Metadata {\n const title =\n input.seo?.title?.trim() ||\n resolveSeoTitle(input, {\n template: input.config.seoTitleTemplate,\n siteName: input.config.siteName,\n })\n\n const metadata: Metadata = {}\n if (title) metadata.title = { absolute: title }\n const description = input.description?.trim()\n if (description) metadata.description = description\n return metadata\n}\n"],"mappings":";AAsBO,IAAM,6BAA6B;AAEnC,IAAM,wBAAwB;AAE9B,IAAM,4BAA4B;AAElC,IAAM,gCAAgC;AAEtC,IAAM,mCAAmC;AAKzC,SAAS,yBAAyB,UAAgD;AACvF,QAAM,cAAc,SAAS,MAAM,qBAAqB,EAAE,SAAS;AACnE,MAAI,gBAAgB,EAAG,QAAO;AAC9B,MAAI,cAAc,EAAG,QAAO;AAC5B,MAAI,SAAS,SAAS,8BAA+B,QAAO;AAC5D,SAAO;AACT;AAOO,SAAS,wBAAwB,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,MAAM,KAAK,OAAO,KAAK,KACvB,gBAAgB,OAAO;AAAA,IACrB,UAAU,MAAM,OAAO;AAAA,IACvB,UAAU,MAAM,OAAO;AAAA,EACzB,CAAC;AAEH,QAAM,WAAqB,CAAC;AAC5B,MAAI,MAAO,UAAS,QAAQ,EAAE,UAAU,MAAM;AAC9C,QAAM,cAAc,MAAM,aAAa,KAAK;AAC5C,MAAI,YAAa,UAAS,cAAc;AACxC,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/seo.ts"],"sourcesContent":["/**\n * `@reblu/site-next/seo` — the ONE page-title rule (REB-871), shared by the\n * Reblu SITE API (which serves `seo.title` already resolved on every detail\n * endpoint) and by SITEs (index/list routes, or an older API without `seo`).\n *\n * The rule, in order:\n * 1. An entity SEO title (`seoTitle` / `metaTitle`) that is non-empty after\n * trimming is the WHOLE title — used as-is, never suffixed.\n * 2. Otherwise the tenant template (`SiteSettings.seoTitleTemplate`, default\n * `%s | {siteName}`) is applied ONCE to the display title — the entity\n * title on a detail route, the section label on a list/index route.\n * 3. The brand is never duplicated: a display title that already names the\n * site is used alone, and a site with no name drops the brand part.\n *\n * Own tsup entry with ZERO runtime dependencies (no React, no `next` — only\n * the `Metadata` TYPE) so base-api can import it server-side and a SITE can\n * call it from `generateMetadata` with no RSC-boundary cost. It must never\n * carry `'use client'`.\n */\nimport type { Metadata } from 'next'\n\n/** Applied when the tenant never chose a template (`seoTitleTemplate` NULL). */\nexport const DEFAULT_SEO_TITLE_TEMPLATE = '%s | {siteName}'\n/** The display-title placeholder — must appear exactly once in a template. */\nexport const SEO_TITLE_PLACEHOLDER = '%s'\n/** Optional brand placeholder, replaced by `siteName`. */\nexport const SEO_SITE_NAME_PLACEHOLDER = '{siteName}'\n/** Upper bound for a stored template (write-side validation). */\nexport const SEO_TITLE_TEMPLATE_MAX_LENGTH = 60\n/** Recommended length of a full page title in search results. */\nexport const SEO_TITLE_RECOMMENDED_MAX_LENGTH = 60\n\nexport type SeoTitleTemplateIssue = 'missing_placeholder' | 'multiple_placeholders' | 'too_long'\n\n/** `null` when `template` is a valid title template, otherwise why it is not. */\nexport function validateSeoTitleTemplate(template: string): SeoTitleTemplateIssue | null {\n const occurrences = template.split(SEO_TITLE_PLACEHOLDER).length - 1\n if (occurrences === 0) return 'missing_placeholder'\n if (occurrences > 1) return 'multiple_placeholders'\n if (template.length > SEO_TITLE_TEMPLATE_MAX_LENGTH) return 'too_long'\n return null\n}\n\n/**\n * The template to apply: the stored one (trimmed) when valid, otherwise the\n * default. An invalid stored value (hand-edited row) degrades to the default\n * instead of producing a broken title.\n */\nexport function resolveSeoTitleTemplate(template: string | null | undefined): string {\n const trimmed = template?.trim() ?? ''\n if (trimmed && validateSeoTitleTemplate(trimmed) === null) return trimmed\n return DEFAULT_SEO_TITLE_TEMPLATE\n}\n\nexport interface SeoTitleInput {\n /** Entity SEO title (`seoTitle` on pages, `metaTitle` on posts/products/courses). */\n seoTitle?: string | null\n /** Display title of the entity (detail routes). */\n title?: string | null\n /** Label of a list/index route (e.g. \"Blog\"), used when there is no entity title. */\n sectionLabel?: string | null\n}\n\nexport interface SeoTitleContext {\n /** `Config.seoTitleTemplate` — null/undefined/invalid → the default. */\n template?: string | null\n /** `Config.siteName`. */\n siteName?: string | null\n}\n\n/** A letter, digit or combining mark — accents included (Unicode-aware). */\nconst WORD_CHAR_AT_END = /[\\p{L}\\p{N}\\p{M}]$/u\nconst WORD_CHAR_AT_START = /^[\\p{L}\\p{N}\\p{M}]/u\n\n/**\n * Whether `phrase` occurs in `text` as a whole word/phrase (case-insensitive):\n * the brand \"Arte\" is in \"Galería Arte\" but not in \"Cartera\" or \"Artesanía\".\n */\nfunction containsPhrase(text: string, phrase: string): boolean {\n const haystack = text.toLocaleLowerCase()\n const needle = phrase.toLocaleLowerCase()\n for (let i = haystack.indexOf(needle); i !== -1; i = haystack.indexOf(needle, i + 1)) {\n const before = haystack.slice(0, i)\n const after = haystack.slice(i + needle.length)\n if (!WORD_CHAR_AT_END.test(before) && !WORD_CHAR_AT_START.test(after)) return true\n }\n return false\n}\n\nexport function resolveSeoTitle(input: SeoTitleInput, context: SeoTitleContext): string {\n const asIs = input.seoTitle?.trim()\n if (asIs) return asIs\n\n const siteName = context.siteName?.trim() ?? ''\n const display = input.title?.trim() || input.sectionLabel?.trim() || ''\n if (!display) return siteName\n\n const template = resolveSeoTitleTemplate(context.template)\n if (template.includes(SEO_SITE_NAME_PLACEHOLDER)) {\n if (!siteName) return display\n if (containsPhrase(display, siteName)) return display\n }\n\n // Split on the placeholder BEFORE inserting the display title, so the title\n // itself is never scanned for placeholders (applied exactly once) and no\n // `String.replace` special pattern (`$&`, `$1`) can reach it.\n const [before = '', after = ''] = template.split(SEO_TITLE_PLACEHOLDER)\n const brand = (part: string) => part.split(SEO_SITE_NAME_PLACEHOLDER).join(siteName)\n return `${brand(before)}${display}${brand(after)}`.trim()\n}\n\nexport type CanonicalUrlIssue = 'invalid' | 'not_https' | 'not_origin'\n\n/**\n * REB-651 — `null` when `value` is a valid canonical site URL: an absolute\n * `https` origin, with nothing after the host but optional trailing slashes\n * (no path, query, fragment or credentials). Otherwise why it is not.\n */\nexport function validateCanonicalUrl(value: string): CanonicalUrlIssue | null {\n const trimmed = value.trim()\n let url: URL\n try {\n url = new URL(trimmed)\n } catch {\n return 'invalid'\n }\n if (url.protocol !== 'https:') return 'not_https'\n // `?` / `#` with nothing after them parse to an empty search/hash, so the\n // raw string is checked as well: a bare `?` is still not an origin.\n if (url.username || url.password || url.search || url.hash || /[?#]/.test(trimmed)) {\n return 'not_origin'\n }\n if (url.pathname.replace(/\\/+$/, '') !== '') return 'not_origin'\n return null\n}\n\n/**\n * The stored/served form of a canonical site URL: the origin with no trailing\n * slash (`https://example.com`), host lower-cased and default port dropped.\n * `null` when unset or invalid — a hand-edited row never yields a broken\n * `metadataBase`.\n */\nexport function normalizeCanonicalUrl(value: string | null | undefined): string | null {\n const trimmed = value?.trim()\n if (!trimmed || validateCanonicalUrl(trimmed) !== null) return null\n return new URL(trimmed).origin\n}\n\n/** The site-level SEO fields of `GET /api/site/config` (REB-651). */\nexport interface SiteSeoConfig {\n siteName?: string | null\n siteDescription?: string | null\n /** `Config.seoTitle` — the site's own search title. */\n seoTitle?: string | null\n /** `Config.seoDescription` — the site's own search description. */\n seoDescription?: string | null\n /** `Config.canonicalUrl` — the site origin, fed to `metadataBase`. */\n canonicalUrl?: string | null\n}\n\n/**\n * The home page title (REB-651): a non-empty site `seoTitle` is used as-is —\n * never suffixed by the template, the same rule as an entity SEO title —\n * otherwise `siteName`, exactly as before the field existed.\n */\nexport function resolveSiteSeoTitle(config: SiteSeoConfig): string {\n return config.seoTitle?.trim() || config.siteName?.trim() || ''\n}\n\n/** The home page description: `seoDescription`, else `siteDescription`. */\nexport function resolveSiteSeoDescription(config: SiteSeoConfig): string {\n return config.seoDescription?.trim() || config.siteDescription?.trim() || ''\n}\n\nexport interface BuildMetadataInput extends SeoTitleInput {\n /** The detail endpoint's `seo` block — its `title` is already resolved. */\n seo?: { title?: string | null } | null\n /** `GET /api/site/config` (or the subset needed here). */\n config: { seoTitleTemplate?: string | null } & SiteSeoConfig\n description?: string | null\n /**\n * REB-651 — the home / site-level path: the title is the site `seoTitle`\n * as-is (else `siteName`), the description the site `seoDescription` (else\n * `siteDescription`), and a valid `canonicalUrl` becomes `metadataBase`.\n * Explicit on purpose: a page whose title happens to be empty must never be\n * titled with the site's SEO title.\n */\n home?: boolean\n}\n\n/**\n * Next `Metadata` for a SITE route. The title is emitted as `absolute` so a\n * root-layout `title.template` can never append the brand a second time.\n * Description/Open Graph are deliberately minimal here (REB-823 extends them).\n */\nexport function buildMetadata(input: BuildMetadataInput): Metadata {\n if (input.home) return buildSiteMetadata(input)\n\n const title =\n input.seo?.title?.trim() ||\n resolveSeoTitle(input, {\n template: input.config.seoTitleTemplate,\n siteName: input.config.siteName,\n })\n\n const metadata: Metadata = {}\n if (title) metadata.title = { absolute: title }\n const description = input.description?.trim()\n if (description) metadata.description = description\n return metadata\n}\n\nfunction buildSiteMetadata(input: BuildMetadataInput): Metadata {\n const metadata: Metadata = {}\n const canonicalUrl = normalizeCanonicalUrl(input.config.canonicalUrl)\n if (canonicalUrl) metadata.metadataBase = new URL(canonicalUrl)\n\n const title = resolveSiteSeoTitle(input.config)\n if (title) metadata.title = { absolute: title }\n const description = input.description?.trim() || resolveSiteSeoDescription(input.config)\n if (description) metadata.description = description\n\n if (canonicalUrl) metadata.alternates = { canonical: '/' }\n return metadata\n}\n"],"mappings":";AAsBO,IAAM,6BAA6B;AAEnC,IAAM,wBAAwB;AAE9B,IAAM,4BAA4B;AAElC,IAAM,gCAAgC;AAEtC,IAAM,mCAAmC;AAKzC,SAAS,yBAAyB,UAAgD;AACvF,QAAM,cAAc,SAAS,MAAM,qBAAqB,EAAE,SAAS;AACnE,MAAI,gBAAgB,EAAG,QAAO;AAC9B,MAAI,cAAc,EAAG,QAAO;AAC5B,MAAI,SAAS,SAAS,8BAA+B,QAAO;AAC5D,SAAO;AACT;AAOO,SAAS,wBAAwB,UAA6C;AACnF,QAAM,UAAU,UAAU,KAAK,KAAK;AACpC,MAAI,WAAW,yBAAyB,OAAO,MAAM,KAAM,QAAO;AAClE,SAAO;AACT;AAmBA,IAAM,mBAAmB;AACzB,IAAM,qBAAqB;AAM3B,SAAS,eAAe,MAAc,QAAyB;AAC7D,QAAM,WAAW,KAAK,kBAAkB;AACxC,QAAM,SAAS,OAAO,kBAAkB;AACxC,WAAS,IAAI,SAAS,QAAQ,MAAM,GAAG,MAAM,IAAI,IAAI,SAAS,QAAQ,QAAQ,IAAI,CAAC,GAAG;AACpF,UAAM,SAAS,SAAS,MAAM,GAAG,CAAC;AAClC,UAAM,QAAQ,SAAS,MAAM,IAAI,OAAO,MAAM;AAC9C,QAAI,CAAC,iBAAiB,KAAK,MAAM,KAAK,CAAC,mBAAmB,KAAK,KAAK,EAAG,QAAO;AAAA,EAChF;AACA,SAAO;AACT;AAEO,SAAS,gBAAgB,OAAsB,SAAkC;A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AGO,SAAS,0BAA0B,QAA+B;AACvE,SAAO,OAAO,gBAAgB,KAAK,KAAK,OAAO,iBAAiB,KAAK,KAAK;AAC5E;AAuBO,SAAS,cAAc,OAAqC;AACjE,MAAI,MAAM,KAAM,QAAO,kBAAkB,KAAK;AAE9C,QAAM,QACJ,MAAM,KAAK,OAAO,KAAK,KACvB,gBAAgB,OAAO;AAAA,IACrB,UAAU,MAAM,OAAO;AAAA,IACvB,UAAU,MAAM,OAAO;AAAA,EACzB,CAAC;AAEH,QAAM,WAAqB,CAAC;AAC5B,MAAI,MAAO,UAAS,QAAQ,EAAE,UAAU,MAAM;AAC9C,QAAM,cAAc,MAAM,aAAa,KAAK;AAC5C,MAAI,YAAa,UAAS,cAAc;AACxC,SAAO;AACT;AAEA,SAAS,kBAAkB,OAAqC;AAC9D,QAAM,WAAqB,CAAC;AAC5B,QAAM,eAAe,sBAAsB,MAAM,OAAO,YAAY;AACpE,MAAI,aAAc,UAAS,eAAe,IAAI,IAAI,YAAY;AAE9D,QAAM,QAAQ,oBAAoB,MAAM,MAAM;AAC9C,MAAI,MAAO,UAAS,QAAQ,EAAE,UAAU,MAAM;AAC9C,QAAM,cAAc,MAAM,aAAa,KAAK,KAAK,0BAA0B,MAAM,MAAM;AACvF,MAAI,YAAa,UAAS,cAAc;AAExC,MAAI,aAAc,UAAS,aAAa,EAAE,WAAW,IAAI;AACzD,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reblu/site-next",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "Next.js RSC glue for Reblu SITEs — cache + CTA + auth server/client components.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Reblu — Adolfo Unturbe",
@@ -250,9 +250,9 @@
250
250
  "dependencies": {
251
251
  "@radix-ui/react-dialog": "^1.1.15",
252
252
  "zustand": "^5.0.9",
253
- "@reblu/site-contracts": "^1.11.0",
254
- "@reblu/site-ui": "^0.7.0",
255
- "@reblu/site-client": "^5.4.0"
253
+ "@reblu/site-client": "^5.4.0",
254
+ "@reblu/site-contracts": "^1.12.0",
255
+ "@reblu/site-ui": "^0.7.0"
256
256
  },
257
257
  "devDependencies": {
258
258
  "@testing-library/jest-dom": "^6.9.1",