@uniweb/runtime 1.2.4 → 1.2.5
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/ssr.js +1 -18
- package/dist/ssr.js.map +1 -1
- package/package.json +4 -6
- package/src/components/PageRenderer.jsx +1 -2
- package/src/hooks/useHeadMeta.js +1 -17
- package/src/ssr-renderer.js +6 -11
- package/src/head-meta.js +0 -38
package/dist/ssr.js
CHANGED
|
@@ -9,7 +9,6 @@ import { DEFAULT_ICON_BASE, iconUrl } from "@uniweb/core/icon-corpus";
|
|
|
9
9
|
import { buildTheme, FONT_LINKS_MARKER, buildSectionOverrides } from "@uniweb/theming";
|
|
10
10
|
import "@uniweb/core/services";
|
|
11
11
|
import "@uniweb/core/tracker";
|
|
12
|
-
import { pageMarkdownUrls } from "@uniweb/projections/markdown-urls";
|
|
13
12
|
import { escapeHtml } from "@uniweb/core/page-shell";
|
|
14
13
|
import { escapeHtml as escapeHtml2, foundationCssUrl, pageShell } from "@uniweb/core/page-shell";
|
|
15
14
|
import DataStore, { deriveCacheKey as deriveCacheKey$1 } from "@uniweb/core/datastore";
|
|
@@ -496,20 +495,6 @@ function documentTitle(pageTitle, siteName) {
|
|
|
496
495
|
const title = String(pageTitle);
|
|
497
496
|
return siteName ? `${title} | ${siteName}` : title;
|
|
498
497
|
}
|
|
499
|
-
const urlsOfPages = /* @__PURE__ */ new WeakMap();
|
|
500
|
-
function pageHeadMeta(page) {
|
|
501
|
-
return { ...page.getHeadMeta(), markdown: markdownUrlOf(page) };
|
|
502
|
-
}
|
|
503
|
-
function markdownUrlOf(page) {
|
|
504
|
-
const website = page?.website;
|
|
505
|
-
if (!website) return null;
|
|
506
|
-
let urls = urlsOfPages.get(website.pages);
|
|
507
|
-
if (!urls) {
|
|
508
|
-
urls = pageMarkdownUrls({ pages: website.getContentPages(), config: website.config });
|
|
509
|
-
urlsOfPages.set(website.pages, urls);
|
|
510
|
-
}
|
|
511
|
-
return urls.get(page.route) ?? null;
|
|
512
|
-
}
|
|
513
498
|
function resolvePage(website, route) {
|
|
514
499
|
return website.getPage(route);
|
|
515
500
|
}
|
|
@@ -820,7 +805,7 @@ ${options.sectionOverrideCSS}
|
|
|
820
805
|
return result;
|
|
821
806
|
}
|
|
822
807
|
function writeHeadMeta(html, page) {
|
|
823
|
-
const meta = typeof page?.getHeadMeta === "function" ?
|
|
808
|
+
const meta = typeof page?.getHeadMeta === "function" ? page.getHeadMeta() : { description: page?.description || null };
|
|
824
809
|
const end = html.indexOf("</head>");
|
|
825
810
|
if (!meta || end === -1) return html;
|
|
826
811
|
const og = meta.og || {};
|
|
@@ -853,8 +838,6 @@ function writeHeadMeta(html, page) {
|
|
|
853
838
|
for (const { hreflang, url } of meta.alternates || []) {
|
|
854
839
|
written.push(`<link rel="alternate" hreflang="${escapeHtml(hreflang)}" href="${escapeHtml(url)}">`);
|
|
855
840
|
}
|
|
856
|
-
head = head.replace(/<link\b(?=[^>]*\brel=["']alternate["'])(?=[^>]*\btype=["']text\/markdown["'])[^>]*>\s*/gi, "");
|
|
857
|
-
if (meta.markdown) written.push(`<link rel="alternate" type="text/markdown" href="${escapeHtml(meta.markdown)}">`);
|
|
858
841
|
return `${head}${written.join("\n")}
|
|
859
842
|
${html.slice(end)}`;
|
|
860
843
|
}
|