@techninja/clearstack 0.3.35 → 0.3.36
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/lib/build-og.js +5 -2
- package/package.json +1 -1
package/lib/build-og.js
CHANGED
|
@@ -22,6 +22,7 @@ import { injectMeta, interpolate } from './og-template.js';
|
|
|
22
22
|
* @property {string} [outDir] - Output directory (default: "dist")
|
|
23
23
|
* @property {string} [baseUrl] - Site base URL for og:url
|
|
24
24
|
* @property {string} [htmlPath] - Path to index.html shell
|
|
25
|
+
* @property {Record<string, unknown>} [context] - Extra data for interpolation
|
|
25
26
|
*/
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -82,11 +83,13 @@ export function buildOG(opts) {
|
|
|
82
83
|
const out = resolve(projectDir, outDir);
|
|
83
84
|
let pages = 0;
|
|
84
85
|
|
|
86
|
+
const ctx = opts.context || {};
|
|
87
|
+
|
|
85
88
|
for (const [pattern, config] of Object.entries(routes)) {
|
|
86
89
|
const isDynamic = pattern.includes(':');
|
|
87
90
|
|
|
88
91
|
if (!isDynamic) {
|
|
89
|
-
const data = { app: { name: baseUrl } };
|
|
92
|
+
const data = { app: { name: baseUrl }, ...ctx };
|
|
90
93
|
const meta = resolveMeta(config, data, baseUrl, pattern);
|
|
91
94
|
writePage(out, pattern, shell, meta);
|
|
92
95
|
pages++;
|
|
@@ -97,7 +100,7 @@ export function buildOG(opts) {
|
|
|
97
100
|
const slug = item.slug || item.id || item[paramName];
|
|
98
101
|
if (!slug) continue;
|
|
99
102
|
const path = pattern.replace(`:${paramName}`, String(slug));
|
|
100
|
-
const data = { [paramName]: item, item, app: { name: baseUrl } };
|
|
103
|
+
const data = { [paramName]: item, item, app: { name: baseUrl }, ...ctx };
|
|
101
104
|
const meta = resolveMeta(config, data, baseUrl, path);
|
|
102
105
|
writePage(out, path, shell, meta);
|
|
103
106
|
pages++;
|
package/package.json
CHANGED