boltdocs 2.9.2 → 2.9.3
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/client/index.cjs +134 -123
- package/dist/client/index.js +134 -123
- package/dist/{csp-CUAEgrxR.mjs → csp-DtM6q2gZ.mjs} +1 -1
- package/dist/{doctor-hKOBLhBF.mjs → doctor-Bc-Tx_md.mjs} +1 -1
- package/dist/{headers-DBzZ9yC6.mjs → headers-DK0Hw7iB.mjs} +1 -1
- package/dist/node/cli-entry.cjs +1 -1
- package/dist/node/cli-entry.mjs +2 -2
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/node/routes/worker.mjs +1 -1
- package/dist/{node-FkxzriO7.mjs → node-JQ6C-CBi.mjs} +3 -3
- package/dist/{node-B-I15rGR.cjs → node-cZgna618.cjs} +2 -2
- package/dist/{package-CVw_u5VT.cjs → package-BlYktJR3.cjs} +1 -1
- package/dist/{package-D6O7a8qA.mjs → package-Di7alQGe.mjs} +1 -1
- package/dist/{parser-8u0xHVc7.mjs → parser-Ww0eOqs7.mjs} +1 -1
- package/dist/{plugin-Dqj9plKB.cjs → plugin-BCCYSeId.cjs} +7 -7
- package/dist/plugin-Bu75gPjx.mjs +61 -0
- package/dist/{routes-Bm0CQvyL.mjs → routes-DMBny9t9.mjs} +1 -1
- package/dist/{routes-BTx0ngdX.mjs → routes-DZjS8QSV.mjs} +1 -1
- package/package.json +1 -1
- package/dist/plugin-CHa0IT49.mjs +0 -61
package/dist/client/index.cjs
CHANGED
|
@@ -159,6 +159,132 @@ const mdxComponentsDefault = {
|
|
|
159
159
|
"404": NotFound
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/client/utils/i18n.ts
|
|
164
|
+
/**
|
|
165
|
+
* Retrieves the correct translation from a value that can be either
|
|
166
|
+
* a simple string or a map of locale-specific strings.
|
|
167
|
+
*
|
|
168
|
+
* @param value - The text to translate
|
|
169
|
+
* @param locale - The current active locale (e.g., 'en', 'es')
|
|
170
|
+
* @returns The translated string
|
|
171
|
+
*/
|
|
172
|
+
function getTranslated(value, locale) {
|
|
173
|
+
if (!value) return "";
|
|
174
|
+
if (typeof value === "string") return value;
|
|
175
|
+
if (locale && value[locale]) return value[locale];
|
|
176
|
+
return Object.values(value)[0] || "";
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/client/app/head.tsx
|
|
181
|
+
function Head({ siteTitle, siteDescription, routes }) {
|
|
182
|
+
const location = (0, react_router_dom.useLocation)();
|
|
183
|
+
const config = require_icons_dev.useConfig();
|
|
184
|
+
const { currentLocale, currentRoute } = require_icons_dev.useRoutes();
|
|
185
|
+
const route = (0, react.useMemo)(() => {
|
|
186
|
+
if (currentRoute) return currentRoute;
|
|
187
|
+
const normalizedPath = location.pathname.endsWith("/") && location.pathname.length > 1 ? location.pathname.slice(0, -1) : location.pathname;
|
|
188
|
+
return routes?.find?.((r) => {
|
|
189
|
+
return (r.path.endsWith("/") && r.path.length > 1 ? r.path.slice(0, -1) : r.path) === normalizedPath;
|
|
190
|
+
});
|
|
191
|
+
}, [
|
|
192
|
+
routes,
|
|
193
|
+
location.pathname,
|
|
194
|
+
currentRoute
|
|
195
|
+
]);
|
|
196
|
+
const pageTitle = route?.title;
|
|
197
|
+
const translatedSiteDescription = getTranslated(siteDescription, currentLocale);
|
|
198
|
+
const pageDescription = route?.description || translatedSiteDescription || "";
|
|
199
|
+
const translatedSiteTitle = getTranslated(siteTitle, currentLocale);
|
|
200
|
+
const finalTitle = pageTitle ? `${pageTitle} | ${translatedSiteTitle}` : translatedSiteTitle;
|
|
201
|
+
const seo = route?.seo || {};
|
|
202
|
+
const canonicalUrl = seo.canonical || (config?.siteUrl && route?.path ? `${config.siteUrl.replace(/\/$/, "")}${route.path}` : void 0);
|
|
203
|
+
const ogUrl = seo["og:url"] || canonicalUrl || (typeof window !== "undefined" ? window.location.href : void 0);
|
|
204
|
+
const globalMetatags = config?.seo?.metatags || {};
|
|
205
|
+
const defaultOgImage = config?.seo?.thumbnails?.background;
|
|
206
|
+
let ogImage = seo["og:image"] || route?.coverImage || defaultOgImage;
|
|
207
|
+
if (ogImage && config?.siteUrl && !/^https?:\/\/|^\/\//.test(ogImage)) ogImage = `${config.siteUrl.endsWith("/") ? config.siteUrl.slice(0, -1) : config.siteUrl}${ogImage.startsWith("/") ? ogImage : `/${ogImage}`}`;
|
|
208
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Helmet, { children: [
|
|
209
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("title", { children: finalTitle }),
|
|
210
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
211
|
+
name: "description",
|
|
212
|
+
content: pageDescription
|
|
213
|
+
}),
|
|
214
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
215
|
+
property: "og:title",
|
|
216
|
+
content: finalTitle
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
219
|
+
property: "og:description",
|
|
220
|
+
content: pageDescription
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
223
|
+
property: "og:type",
|
|
224
|
+
content: "article"
|
|
225
|
+
}),
|
|
226
|
+
canonicalUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
227
|
+
rel: "canonical",
|
|
228
|
+
href: canonicalUrl
|
|
229
|
+
}),
|
|
230
|
+
ogUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
231
|
+
property: "og:url",
|
|
232
|
+
content: ogUrl
|
|
233
|
+
}),
|
|
234
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
235
|
+
name: "twitter:card",
|
|
236
|
+
content: ogImage ? "summary_large_image" : "summary"
|
|
237
|
+
}),
|
|
238
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
239
|
+
name: "twitter:title",
|
|
240
|
+
content: finalTitle
|
|
241
|
+
}),
|
|
242
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
243
|
+
name: "twitter:description",
|
|
244
|
+
content: pageDescription
|
|
245
|
+
}),
|
|
246
|
+
ogImage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
247
|
+
name: "twitter:image",
|
|
248
|
+
content: ogImage
|
|
249
|
+
}),
|
|
250
|
+
ogImage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
251
|
+
property: "og:image",
|
|
252
|
+
content: ogImage
|
|
253
|
+
}),
|
|
254
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
255
|
+
name: "generator",
|
|
256
|
+
content: "Boltdocs"
|
|
257
|
+
}),
|
|
258
|
+
Object.entries(globalMetatags).map(([key, value]) => {
|
|
259
|
+
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
260
|
+
property: key,
|
|
261
|
+
content: value
|
|
262
|
+
}, key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
263
|
+
name: key,
|
|
264
|
+
content: value
|
|
265
|
+
}, key);
|
|
266
|
+
}),
|
|
267
|
+
Object.entries(seo).map(([key, value]) => {
|
|
268
|
+
if (key === "noindex" && value === true) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
269
|
+
name: "robots",
|
|
270
|
+
content: "noindex"
|
|
271
|
+
}, "noindex");
|
|
272
|
+
if (key === "robots") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
273
|
+
name: "robots",
|
|
274
|
+
content: value
|
|
275
|
+
}, "robots");
|
|
276
|
+
if (key === "canonical" || key === "og:url" || key === "og:image" || key === "twitter:image") return null;
|
|
277
|
+
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
278
|
+
property: key,
|
|
279
|
+
content: value
|
|
280
|
+
}, key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
281
|
+
name: key,
|
|
282
|
+
content: value
|
|
283
|
+
}, key);
|
|
284
|
+
})
|
|
285
|
+
] });
|
|
286
|
+
}
|
|
287
|
+
|
|
162
288
|
//#endregion
|
|
163
289
|
//#region src/client/collections/collections-context.tsx
|
|
164
290
|
const CollectionsContext = (0, react.createContext)({});
|
|
@@ -251,6 +377,11 @@ function BoltdocsShell({ config, routes, components = {}, collectionsData }) {
|
|
|
251
377
|
routeMap
|
|
252
378
|
}),
|
|
253
379
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I18nUpdater, { config }),
|
|
380
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Head, {
|
|
381
|
+
siteTitle: config.theme?.title,
|
|
382
|
+
siteDescription: config.theme?.description,
|
|
383
|
+
routes
|
|
384
|
+
}),
|
|
254
385
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog$1.InternalErrorBoundary, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Outlet, {}) })
|
|
255
386
|
]
|
|
256
387
|
})]
|
|
@@ -523,23 +654,6 @@ function GithubStars({ repo }) {
|
|
|
523
654
|
});
|
|
524
655
|
}
|
|
525
656
|
|
|
526
|
-
//#endregion
|
|
527
|
-
//#region src/client/utils/i18n.ts
|
|
528
|
-
/**
|
|
529
|
-
* Retrieves the correct translation from a value that can be either
|
|
530
|
-
* a simple string or a map of locale-specific strings.
|
|
531
|
-
*
|
|
532
|
-
* @param value - The text to translate
|
|
533
|
-
* @param locale - The current active locale (e.g., 'en', 'es')
|
|
534
|
-
* @returns The translated string
|
|
535
|
-
*/
|
|
536
|
-
function getTranslated(value, locale) {
|
|
537
|
-
if (!value) return "";
|
|
538
|
-
if (typeof value === "string") return value;
|
|
539
|
-
if (locale && value[locale]) return value[locale];
|
|
540
|
-
return Object.values(value)[0] || "";
|
|
541
|
-
}
|
|
542
|
-
|
|
543
657
|
//#endregion
|
|
544
658
|
//#region src/client/hooks/use-navbar.ts
|
|
545
659
|
function useNavbar() {
|
|
@@ -1736,117 +1850,14 @@ const NotFoundWrapper = () => {
|
|
|
1736
1850
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(components.NotFound || components["404"] || NotFound, {});
|
|
1737
1851
|
};
|
|
1738
1852
|
|
|
1739
|
-
//#endregion
|
|
1740
|
-
//#region src/client/app/head.tsx
|
|
1741
|
-
function Head({ siteTitle, siteDescription, routes }) {
|
|
1742
|
-
const location = (0, react_router_dom.useLocation)();
|
|
1743
|
-
const config = require_icons_dev.useConfig();
|
|
1744
|
-
const { currentLocale } = require_icons_dev.useRoutes();
|
|
1745
|
-
const currentRoute = (0, react.useMemo)(() => routes?.find?.((r) => r.path === location.pathname), [routes, location.pathname]);
|
|
1746
|
-
const pageTitle = currentRoute?.title;
|
|
1747
|
-
const translatedSiteDescription = getTranslated(siteDescription, currentLocale);
|
|
1748
|
-
const pageDescription = currentRoute?.description || translatedSiteDescription || "";
|
|
1749
|
-
const translatedSiteTitle = getTranslated(siteTitle, currentLocale);
|
|
1750
|
-
const finalTitle = pageTitle ? `${pageTitle} | ${translatedSiteTitle}` : translatedSiteTitle;
|
|
1751
|
-
const seo = currentRoute?.seo || {};
|
|
1752
|
-
const canonicalUrl = seo.canonical || (config?.siteUrl && currentRoute?.path ? `${config.siteUrl.replace(/\/$/, "")}${currentRoute.path}` : void 0);
|
|
1753
|
-
const ogUrl = seo["og:url"] || canonicalUrl || (typeof window !== "undefined" ? window.location.href : void 0);
|
|
1754
|
-
const globalMetatags = config?.seo?.metatags || {};
|
|
1755
|
-
const defaultOgImage = config?.seo?.thumbnails?.background;
|
|
1756
|
-
const ogImage = seo["og:image"] || defaultOgImage;
|
|
1757
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Helmet, { children: [
|
|
1758
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("title", { children: finalTitle }),
|
|
1759
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1760
|
-
name: "description",
|
|
1761
|
-
content: pageDescription
|
|
1762
|
-
}),
|
|
1763
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1764
|
-
property: "og:title",
|
|
1765
|
-
content: finalTitle
|
|
1766
|
-
}),
|
|
1767
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1768
|
-
property: "og:description",
|
|
1769
|
-
content: pageDescription
|
|
1770
|
-
}),
|
|
1771
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1772
|
-
property: "og:type",
|
|
1773
|
-
content: "article"
|
|
1774
|
-
}),
|
|
1775
|
-
canonicalUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
1776
|
-
rel: "canonical",
|
|
1777
|
-
href: canonicalUrl
|
|
1778
|
-
}),
|
|
1779
|
-
ogUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1780
|
-
property: "og:url",
|
|
1781
|
-
content: ogUrl
|
|
1782
|
-
}),
|
|
1783
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1784
|
-
name: "twitter:card",
|
|
1785
|
-
content: "summary"
|
|
1786
|
-
}),
|
|
1787
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1788
|
-
name: "twitter:title",
|
|
1789
|
-
content: finalTitle
|
|
1790
|
-
}),
|
|
1791
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1792
|
-
name: "twitter:description",
|
|
1793
|
-
content: pageDescription
|
|
1794
|
-
}),
|
|
1795
|
-
ogImage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1796
|
-
name: "twitter:image",
|
|
1797
|
-
content: ogImage
|
|
1798
|
-
}),
|
|
1799
|
-
ogImage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1800
|
-
property: "og:image",
|
|
1801
|
-
content: ogImage
|
|
1802
|
-
}),
|
|
1803
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1804
|
-
name: "generator",
|
|
1805
|
-
content: "Boltdocs"
|
|
1806
|
-
}),
|
|
1807
|
-
Object.entries(globalMetatags).map(([key, value]) => {
|
|
1808
|
-
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1809
|
-
property: key,
|
|
1810
|
-
content: value
|
|
1811
|
-
}, key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1812
|
-
name: key,
|
|
1813
|
-
content: value
|
|
1814
|
-
}, key);
|
|
1815
|
-
}),
|
|
1816
|
-
Object.entries(seo).map(([key, value]) => {
|
|
1817
|
-
if (key === "noindex" && value === true) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1818
|
-
name: "robots",
|
|
1819
|
-
content: "noindex"
|
|
1820
|
-
}, "noindex");
|
|
1821
|
-
if (key === "robots") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1822
|
-
name: "robots",
|
|
1823
|
-
content: value
|
|
1824
|
-
}, "robots");
|
|
1825
|
-
if (key === "canonical" || key === "og:url") return null;
|
|
1826
|
-
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1827
|
-
property: key,
|
|
1828
|
-
content: value
|
|
1829
|
-
}, key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1830
|
-
name: key,
|
|
1831
|
-
content: value
|
|
1832
|
-
}, key);
|
|
1833
|
-
})
|
|
1834
|
-
] });
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
1853
|
//#endregion
|
|
1838
1854
|
//#region src/client/app/docs-layout.tsx
|
|
1839
1855
|
function DocsLayout({ collectionsData }) {
|
|
1840
|
-
const
|
|
1841
|
-
const
|
|
1842
|
-
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Head, {
|
|
1843
|
-
siteTitle: config.theme?.title,
|
|
1844
|
-
siteDescription: config.theme?.description,
|
|
1845
|
-
routes: allRoutes || []
|
|
1846
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog$1.InternalErrorBoundary, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(virtual_boltdocs_layout.default, {
|
|
1856
|
+
const { currentRoute } = require_icons_dev.useRoutes();
|
|
1857
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog$1.InternalErrorBoundary, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(virtual_boltdocs_layout.default, {
|
|
1847
1858
|
route: currentRoute,
|
|
1848
1859
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Outlet, {})
|
|
1849
|
-
}) })
|
|
1860
|
+
}) });
|
|
1850
1861
|
if (collectionsData) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollectionsContext.Provider, {
|
|
1851
1862
|
value: collectionsData,
|
|
1852
1863
|
children: content
|
package/dist/client/index.js
CHANGED
|
@@ -154,6 +154,132 @@ const mdxComponentsDefault = {
|
|
|
154
154
|
"404": NotFound
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/client/utils/i18n.ts
|
|
159
|
+
/**
|
|
160
|
+
* Retrieves the correct translation from a value that can be either
|
|
161
|
+
* a simple string or a map of locale-specific strings.
|
|
162
|
+
*
|
|
163
|
+
* @param value - The text to translate
|
|
164
|
+
* @param locale - The current active locale (e.g., 'en', 'es')
|
|
165
|
+
* @returns The translated string
|
|
166
|
+
*/
|
|
167
|
+
function getTranslated(value, locale) {
|
|
168
|
+
if (!value) return "";
|
|
169
|
+
if (typeof value === "string") return value;
|
|
170
|
+
if (locale && value[locale]) return value[locale];
|
|
171
|
+
return Object.values(value)[0] || "";
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/client/app/head.tsx
|
|
176
|
+
function Head({ siteTitle, siteDescription, routes }) {
|
|
177
|
+
const location = useLocation$1();
|
|
178
|
+
const config = useConfig();
|
|
179
|
+
const { currentLocale, currentRoute } = useRoutes();
|
|
180
|
+
const route = useMemo(() => {
|
|
181
|
+
if (currentRoute) return currentRoute;
|
|
182
|
+
const normalizedPath = location.pathname.endsWith("/") && location.pathname.length > 1 ? location.pathname.slice(0, -1) : location.pathname;
|
|
183
|
+
return routes?.find?.((r) => {
|
|
184
|
+
return (r.path.endsWith("/") && r.path.length > 1 ? r.path.slice(0, -1) : r.path) === normalizedPath;
|
|
185
|
+
});
|
|
186
|
+
}, [
|
|
187
|
+
routes,
|
|
188
|
+
location.pathname,
|
|
189
|
+
currentRoute
|
|
190
|
+
]);
|
|
191
|
+
const pageTitle = route?.title;
|
|
192
|
+
const translatedSiteDescription = getTranslated(siteDescription, currentLocale);
|
|
193
|
+
const pageDescription = route?.description || translatedSiteDescription || "";
|
|
194
|
+
const translatedSiteTitle = getTranslated(siteTitle, currentLocale);
|
|
195
|
+
const finalTitle = pageTitle ? `${pageTitle} | ${translatedSiteTitle}` : translatedSiteTitle;
|
|
196
|
+
const seo = route?.seo || {};
|
|
197
|
+
const canonicalUrl = seo.canonical || (config?.siteUrl && route?.path ? `${config.siteUrl.replace(/\/$/, "")}${route.path}` : void 0);
|
|
198
|
+
const ogUrl = seo["og:url"] || canonicalUrl || (typeof window !== "undefined" ? window.location.href : void 0);
|
|
199
|
+
const globalMetatags = config?.seo?.metatags || {};
|
|
200
|
+
const defaultOgImage = config?.seo?.thumbnails?.background;
|
|
201
|
+
let ogImage = seo["og:image"] || route?.coverImage || defaultOgImage;
|
|
202
|
+
if (ogImage && config?.siteUrl && !/^https?:\/\/|^\/\//.test(ogImage)) ogImage = `${config.siteUrl.endsWith("/") ? config.siteUrl.slice(0, -1) : config.siteUrl}${ogImage.startsWith("/") ? ogImage : `/${ogImage}`}`;
|
|
203
|
+
return /* @__PURE__ */ jsxs(Helmet, { children: [
|
|
204
|
+
/* @__PURE__ */ jsx("title", { children: finalTitle }),
|
|
205
|
+
/* @__PURE__ */ jsx("meta", {
|
|
206
|
+
name: "description",
|
|
207
|
+
content: pageDescription
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ jsx("meta", {
|
|
210
|
+
property: "og:title",
|
|
211
|
+
content: finalTitle
|
|
212
|
+
}),
|
|
213
|
+
/* @__PURE__ */ jsx("meta", {
|
|
214
|
+
property: "og:description",
|
|
215
|
+
content: pageDescription
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ jsx("meta", {
|
|
218
|
+
property: "og:type",
|
|
219
|
+
content: "article"
|
|
220
|
+
}),
|
|
221
|
+
canonicalUrl && /* @__PURE__ */ jsx("link", {
|
|
222
|
+
rel: "canonical",
|
|
223
|
+
href: canonicalUrl
|
|
224
|
+
}),
|
|
225
|
+
ogUrl && /* @__PURE__ */ jsx("meta", {
|
|
226
|
+
property: "og:url",
|
|
227
|
+
content: ogUrl
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ jsx("meta", {
|
|
230
|
+
name: "twitter:card",
|
|
231
|
+
content: ogImage ? "summary_large_image" : "summary"
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ jsx("meta", {
|
|
234
|
+
name: "twitter:title",
|
|
235
|
+
content: finalTitle
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ jsx("meta", {
|
|
238
|
+
name: "twitter:description",
|
|
239
|
+
content: pageDescription
|
|
240
|
+
}),
|
|
241
|
+
ogImage && /* @__PURE__ */ jsx("meta", {
|
|
242
|
+
name: "twitter:image",
|
|
243
|
+
content: ogImage
|
|
244
|
+
}),
|
|
245
|
+
ogImage && /* @__PURE__ */ jsx("meta", {
|
|
246
|
+
property: "og:image",
|
|
247
|
+
content: ogImage
|
|
248
|
+
}),
|
|
249
|
+
/* @__PURE__ */ jsx("meta", {
|
|
250
|
+
name: "generator",
|
|
251
|
+
content: "Boltdocs"
|
|
252
|
+
}),
|
|
253
|
+
Object.entries(globalMetatags).map(([key, value]) => {
|
|
254
|
+
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ jsx("meta", {
|
|
255
|
+
property: key,
|
|
256
|
+
content: value
|
|
257
|
+
}, key) : /* @__PURE__ */ jsx("meta", {
|
|
258
|
+
name: key,
|
|
259
|
+
content: value
|
|
260
|
+
}, key);
|
|
261
|
+
}),
|
|
262
|
+
Object.entries(seo).map(([key, value]) => {
|
|
263
|
+
if (key === "noindex" && value === true) return /* @__PURE__ */ jsx("meta", {
|
|
264
|
+
name: "robots",
|
|
265
|
+
content: "noindex"
|
|
266
|
+
}, "noindex");
|
|
267
|
+
if (key === "robots") return /* @__PURE__ */ jsx("meta", {
|
|
268
|
+
name: "robots",
|
|
269
|
+
content: value
|
|
270
|
+
}, "robots");
|
|
271
|
+
if (key === "canonical" || key === "og:url" || key === "og:image" || key === "twitter:image") return null;
|
|
272
|
+
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ jsx("meta", {
|
|
273
|
+
property: key,
|
|
274
|
+
content: value
|
|
275
|
+
}, key) : /* @__PURE__ */ jsx("meta", {
|
|
276
|
+
name: key,
|
|
277
|
+
content: value
|
|
278
|
+
}, key);
|
|
279
|
+
})
|
|
280
|
+
] });
|
|
281
|
+
}
|
|
282
|
+
|
|
157
283
|
//#endregion
|
|
158
284
|
//#region src/client/collections/collections-context.tsx
|
|
159
285
|
const CollectionsContext = createContext({});
|
|
@@ -246,6 +372,11 @@ function BoltdocsShell({ config, routes, components = {}, collectionsData }) {
|
|
|
246
372
|
routeMap
|
|
247
373
|
}),
|
|
248
374
|
/* @__PURE__ */ jsx(I18nUpdater, { config }),
|
|
375
|
+
/* @__PURE__ */ jsx(Head, {
|
|
376
|
+
siteTitle: config.theme?.title,
|
|
377
|
+
siteDescription: config.theme?.description,
|
|
378
|
+
routes
|
|
379
|
+
}),
|
|
249
380
|
/* @__PURE__ */ jsx(InternalErrorBoundary, { children: /* @__PURE__ */ jsx(Outlet, {}) })
|
|
250
381
|
]
|
|
251
382
|
})]
|
|
@@ -518,23 +649,6 @@ function GithubStars({ repo }) {
|
|
|
518
649
|
});
|
|
519
650
|
}
|
|
520
651
|
|
|
521
|
-
//#endregion
|
|
522
|
-
//#region src/client/utils/i18n.ts
|
|
523
|
-
/**
|
|
524
|
-
* Retrieves the correct translation from a value that can be either
|
|
525
|
-
* a simple string or a map of locale-specific strings.
|
|
526
|
-
*
|
|
527
|
-
* @param value - The text to translate
|
|
528
|
-
* @param locale - The current active locale (e.g., 'en', 'es')
|
|
529
|
-
* @returns The translated string
|
|
530
|
-
*/
|
|
531
|
-
function getTranslated(value, locale) {
|
|
532
|
-
if (!value) return "";
|
|
533
|
-
if (typeof value === "string") return value;
|
|
534
|
-
if (locale && value[locale]) return value[locale];
|
|
535
|
-
return Object.values(value)[0] || "";
|
|
536
|
-
}
|
|
537
|
-
|
|
538
652
|
//#endregion
|
|
539
653
|
//#region src/client/hooks/use-navbar.ts
|
|
540
654
|
function useNavbar() {
|
|
@@ -1731,117 +1845,14 @@ const NotFoundWrapper = () => {
|
|
|
1731
1845
|
return /* @__PURE__ */ jsx(components.NotFound || components["404"] || NotFound, {});
|
|
1732
1846
|
};
|
|
1733
1847
|
|
|
1734
|
-
//#endregion
|
|
1735
|
-
//#region src/client/app/head.tsx
|
|
1736
|
-
function Head({ siteTitle, siteDescription, routes }) {
|
|
1737
|
-
const location = useLocation$1();
|
|
1738
|
-
const config = useConfig();
|
|
1739
|
-
const { currentLocale } = useRoutes();
|
|
1740
|
-
const currentRoute = useMemo(() => routes?.find?.((r) => r.path === location.pathname), [routes, location.pathname]);
|
|
1741
|
-
const pageTitle = currentRoute?.title;
|
|
1742
|
-
const translatedSiteDescription = getTranslated(siteDescription, currentLocale);
|
|
1743
|
-
const pageDescription = currentRoute?.description || translatedSiteDescription || "";
|
|
1744
|
-
const translatedSiteTitle = getTranslated(siteTitle, currentLocale);
|
|
1745
|
-
const finalTitle = pageTitle ? `${pageTitle} | ${translatedSiteTitle}` : translatedSiteTitle;
|
|
1746
|
-
const seo = currentRoute?.seo || {};
|
|
1747
|
-
const canonicalUrl = seo.canonical || (config?.siteUrl && currentRoute?.path ? `${config.siteUrl.replace(/\/$/, "")}${currentRoute.path}` : void 0);
|
|
1748
|
-
const ogUrl = seo["og:url"] || canonicalUrl || (typeof window !== "undefined" ? window.location.href : void 0);
|
|
1749
|
-
const globalMetatags = config?.seo?.metatags || {};
|
|
1750
|
-
const defaultOgImage = config?.seo?.thumbnails?.background;
|
|
1751
|
-
const ogImage = seo["og:image"] || defaultOgImage;
|
|
1752
|
-
return /* @__PURE__ */ jsxs(Helmet, { children: [
|
|
1753
|
-
/* @__PURE__ */ jsx("title", { children: finalTitle }),
|
|
1754
|
-
/* @__PURE__ */ jsx("meta", {
|
|
1755
|
-
name: "description",
|
|
1756
|
-
content: pageDescription
|
|
1757
|
-
}),
|
|
1758
|
-
/* @__PURE__ */ jsx("meta", {
|
|
1759
|
-
property: "og:title",
|
|
1760
|
-
content: finalTitle
|
|
1761
|
-
}),
|
|
1762
|
-
/* @__PURE__ */ jsx("meta", {
|
|
1763
|
-
property: "og:description",
|
|
1764
|
-
content: pageDescription
|
|
1765
|
-
}),
|
|
1766
|
-
/* @__PURE__ */ jsx("meta", {
|
|
1767
|
-
property: "og:type",
|
|
1768
|
-
content: "article"
|
|
1769
|
-
}),
|
|
1770
|
-
canonicalUrl && /* @__PURE__ */ jsx("link", {
|
|
1771
|
-
rel: "canonical",
|
|
1772
|
-
href: canonicalUrl
|
|
1773
|
-
}),
|
|
1774
|
-
ogUrl && /* @__PURE__ */ jsx("meta", {
|
|
1775
|
-
property: "og:url",
|
|
1776
|
-
content: ogUrl
|
|
1777
|
-
}),
|
|
1778
|
-
/* @__PURE__ */ jsx("meta", {
|
|
1779
|
-
name: "twitter:card",
|
|
1780
|
-
content: "summary"
|
|
1781
|
-
}),
|
|
1782
|
-
/* @__PURE__ */ jsx("meta", {
|
|
1783
|
-
name: "twitter:title",
|
|
1784
|
-
content: finalTitle
|
|
1785
|
-
}),
|
|
1786
|
-
/* @__PURE__ */ jsx("meta", {
|
|
1787
|
-
name: "twitter:description",
|
|
1788
|
-
content: pageDescription
|
|
1789
|
-
}),
|
|
1790
|
-
ogImage && /* @__PURE__ */ jsx("meta", {
|
|
1791
|
-
name: "twitter:image",
|
|
1792
|
-
content: ogImage
|
|
1793
|
-
}),
|
|
1794
|
-
ogImage && /* @__PURE__ */ jsx("meta", {
|
|
1795
|
-
property: "og:image",
|
|
1796
|
-
content: ogImage
|
|
1797
|
-
}),
|
|
1798
|
-
/* @__PURE__ */ jsx("meta", {
|
|
1799
|
-
name: "generator",
|
|
1800
|
-
content: "Boltdocs"
|
|
1801
|
-
}),
|
|
1802
|
-
Object.entries(globalMetatags).map(([key, value]) => {
|
|
1803
|
-
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ jsx("meta", {
|
|
1804
|
-
property: key,
|
|
1805
|
-
content: value
|
|
1806
|
-
}, key) : /* @__PURE__ */ jsx("meta", {
|
|
1807
|
-
name: key,
|
|
1808
|
-
content: value
|
|
1809
|
-
}, key);
|
|
1810
|
-
}),
|
|
1811
|
-
Object.entries(seo).map(([key, value]) => {
|
|
1812
|
-
if (key === "noindex" && value === true) return /* @__PURE__ */ jsx("meta", {
|
|
1813
|
-
name: "robots",
|
|
1814
|
-
content: "noindex"
|
|
1815
|
-
}, "noindex");
|
|
1816
|
-
if (key === "robots") return /* @__PURE__ */ jsx("meta", {
|
|
1817
|
-
name: "robots",
|
|
1818
|
-
content: value
|
|
1819
|
-
}, "robots");
|
|
1820
|
-
if (key === "canonical" || key === "og:url") return null;
|
|
1821
|
-
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ jsx("meta", {
|
|
1822
|
-
property: key,
|
|
1823
|
-
content: value
|
|
1824
|
-
}, key) : /* @__PURE__ */ jsx("meta", {
|
|
1825
|
-
name: key,
|
|
1826
|
-
content: value
|
|
1827
|
-
}, key);
|
|
1828
|
-
})
|
|
1829
|
-
] });
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
1848
|
//#endregion
|
|
1833
1849
|
//#region src/client/app/docs-layout.tsx
|
|
1834
1850
|
function DocsLayout({ collectionsData }) {
|
|
1835
|
-
const
|
|
1836
|
-
const
|
|
1837
|
-
const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Head, {
|
|
1838
|
-
siteTitle: config.theme?.title,
|
|
1839
|
-
siteDescription: config.theme?.description,
|
|
1840
|
-
routes: allRoutes || []
|
|
1841
|
-
}), /* @__PURE__ */ jsx(InternalErrorBoundary, { children: /* @__PURE__ */ jsx(UserLayout, {
|
|
1851
|
+
const { currentRoute } = useRoutes();
|
|
1852
|
+
const content = /* @__PURE__ */ jsx(InternalErrorBoundary, { children: /* @__PURE__ */ jsx(UserLayout, {
|
|
1842
1853
|
route: currentRoute,
|
|
1843
1854
|
children: /* @__PURE__ */ jsx(Outlet, {})
|
|
1844
|
-
}) })
|
|
1855
|
+
}) });
|
|
1845
1856
|
if (collectionsData) return /* @__PURE__ */ jsx(CollectionsContext.Provider, {
|
|
1846
1857
|
value: collectionsData,
|
|
1847
1858
|
children: content
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import{A as e}from"./node-
|
|
6
|
+
import{A as e}from"./node-JQ6C-CBi.mjs";var t=e({getCSPHeader:()=>n});function n(e){let t=process.env.NODE_ENV===`development`,n={"default-src":[`'self'`],"script-src":[`'self'`,`'unsafe-inline'`],"style-src":[`'self'`,`'unsafe-inline'`],"img-src":[`'self'`,`data:`,`https:`],"font-src":[`'self'`],"connect-src":[`'self'`]};return t&&(n[`script-src`]=[`'self'`,`'unsafe-eval'`,`'unsafe-inline'`],n[`style-src`]=[`'self'`,`'unsafe-inline'`]),Object.entries(n).map(([e,t])=>`${e} ${t.join(` `)}`).join(`; `)}export{n,t};
|