-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathchrome.ts
More file actions
63 lines (58 loc) · 2.48 KB
/
chrome.ts
File metadata and controls
63 lines (58 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* @module Infrastructure/RenderLib/Chrome
* @category Intelligence Operations / Supporting Infrastructure
* @name Shared HTML chrome (head / header / footer / SEO) for articles
*
* @description
* Façade module that delegates to the decomposed bounded-context modules
* in `./chrome/` (types, helpers, head, header, footer). Maintains the
* same public API as the original monolithic `chrome.ts` so all existing
* importers (`article.ts`, `generate-news-indexes/template.ts`,
* `sitemap-html/render/page.ts`, etc.) continue to work without changes.
*
* ## Architecture (Round-5 decomposition)
* ```
* chrome.ts (this file — façade)
* └── chrome/
* ├── types.ts — ChromeOptions, SiteChrome, BreadcrumbItem
* ├── helpers.ts — depth(), renderHreflangBlock(), fallbackAlternateHref()
* ├── head.ts — renderChromeHead() — SEO / OG / JSON-LD / hreflang
* ├── header.ts — buildHeaderHtml() — nav / CTA / breadcrumb / hero
* ├── footer.ts — buildFooterHtml() — columns / badges / scripts
* └── index.ts — barrel re-export
* ```
*
* Each sub-module is independently testable in isolation.
*
* @author Hack23 AB (Infrastructure Team)
* @license Apache-2.0
*/
// Re-export types for backward compatibility
export type { BreadcrumbItem, ChromeOptions, SiteChrome } from './chrome/types.js';
// Re-export sub-module functions
import type { ChromeOptions, SiteChrome } from './chrome/types.js';
import { renderChromeHead as _renderChromeHead } from './chrome/head.js';
import { buildHeaderHtml } from './chrome/header.js';
import { buildFooterHtml } from './chrome/footer.js';
// ---------------------------------------------------------------------------
// Public API — preserves the exact same signatures as the original chrome.ts
// ---------------------------------------------------------------------------
/**
* Render the complete `<!DOCTYPE html><html…><head>…</head>` block.
* Delegates to `chrome/head.ts`.
*/
export function renderChromeHead(opts: ChromeOptions): string {
return _renderChromeHead(opts);
}
/**
* Build the complete site chrome (head + header + footer) for a page.
* Delegates to the decomposed `chrome/head.ts`, `chrome/header.ts`,
* and `chrome/footer.ts` modules.
*/
export function buildChrome(opts: ChromeOptions): SiteChrome {
return {
head: _renderChromeHead(opts),
headerHtml: buildHeaderHtml(opts),
footerHtml: buildFooterHtml(opts),
};
}