Import expanded Knowledge SEO content
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user