SEO: custom share template (canonical, per-page OG, JSON-LD, robots), robots.txt, OG banner; generator sets shareOpenGraphURL; ignis module STEP example
This commit is contained in:
+12
-5
@@ -356,19 +356,26 @@ function run() {
|
||||
}
|
||||
}
|
||||
|
||||
function ensureShareDescription() {
|
||||
function ensureSeoMeta() {
|
||||
const seen = new Set();
|
||||
(function walk(note, depth) {
|
||||
if (depth > 20) return;
|
||||
for (const child of note.getChildNotes()) {
|
||||
if (seen.has(child.noteId)) continue;
|
||||
seen.add(child.noteId);
|
||||
if (child.getLabelValue("publish") === "true") {
|
||||
const desc = child.getLabelValue("summary") || SITE_DESCRIPTION;
|
||||
const published = child.getLabelValue("publish") === "true";
|
||||
const isCat = isCategoryNote(child);
|
||||
if (published || isCat) {
|
||||
const desc = child.getLabelValue("summary") || (isCat ? "Articles in " + child.title : SITE_DESCRIPTION);
|
||||
if (child.getLabelValue("shareDescription") !== desc) {
|
||||
child.setLabel("shareDescription", desc);
|
||||
child.save();
|
||||
api.log("blog_generator: set shareDescription on " + child.title);
|
||||
}
|
||||
const url = SHARE_BASE + "/" + encodeURIComponent(child.getLabelValue("shareAlias") || child.noteId);
|
||||
if (child.getLabelValue("shareOpenGraphURL") !== url) {
|
||||
child.setLabel("shareOpenGraphURL", url);
|
||||
child.save();
|
||||
api.log("blog_generator: set shareOpenGraphURL on " + child.title);
|
||||
}
|
||||
}
|
||||
walk(child, depth + 1);
|
||||
@@ -598,7 +605,7 @@ function run() {
|
||||
buildCategories();
|
||||
buildStateMap();
|
||||
buildSitemap();
|
||||
ensureShareDescription();
|
||||
ensureSeoMeta();
|
||||
buildBlogData();
|
||||
removeEmptyCategories();
|
||||
}
|
||||
Reference in New Issue
Block a user