Import expanded Knowledge SEO content

This commit is contained in:
dcconstructions
2026-07-10 01:51:58 +03:00
parent e08ad18253
commit 2c07dc2df8
27 changed files with 3114 additions and 311 deletions
+4 -4
View File
@@ -548,7 +548,7 @@ function renderHeader(searchPlaceholder) {
}
function pageTitle(record = null) {
if (!record) return knowledge.title || "База знаний";
if (!record) return knowledge.seo?.title || knowledge.title || "База знаний";
return record.node.seo?.title || record.node.title || "Материал";
}
@@ -558,7 +558,7 @@ function visibleTitle(record = null) {
}
function pageDescription(record = null) {
if (!record) return knowledge.settings?.description || "";
if (!record) return knowledge.seo?.description || knowledge.settings?.description || "";
return record.node.seo?.description || stripHtml(renderKnowledgeShortcodes(record.node.bodyHtml)).slice(0, 180);
}
@@ -723,8 +723,8 @@ async function writePage(urlPath, html) {
async function writeSeoFiles(records) {
const sitemapUrls = [
{ loc: canonicalHome(), priority: "1.0" },
{ loc: canonicalForPath(`/${knowledgeBasePath()}/`), priority: "0.8" },
...records.map((record) => ({ loc: canonicalForPath(record.urlPath), priority: record.parents.length ? "0.6" : "0.7" })),
{ loc: canonicalForPath(`/${knowledgeBasePath()}/`), priority: "0.7" },
...records.map((record) => ({ loc: canonicalForPath(record.urlPath), priority: "0.7" })),
];
const sitemapUrl = new URL("sitemap.xml", canonicalHome()).href;
const robots = ["User-agent: *", "Allow: /", `Sitemap: ${sitemapUrl}`, ""].join("\n");