From f086ee6932fb5dc6f1c6a92defbf30f73d611ebe Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Thu, 18 Jan 2024 12:33:12 +0800 Subject: [PATCH] [opt] remove seo_title --- layout/_partial/head.ejs | 3 --- layout/_partial/main/article/article_footer.ejs | 4 ++-- layout/_partial/main/article/read_next.ejs | 4 ++-- layout/_partial/main/navbar/breadcrumb.ejs | 4 ++-- layout/_partial/main/post_list/post_card.ejs | 2 +- layout/_partial/plugins/comments/artalk/script.ejs | 2 +- layout/_partial/widgets/recent.ejs | 2 +- scripts/events/lib/doc_tree.js | 1 - scripts/events/lib/merge_posts.js | 1 - scripts/tags/lib/toc.js | 2 +- 10 files changed, 10 insertions(+), 15 deletions(-) diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index a822a45..7afbe1f 100755 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -1,8 +1,5 @@ <% function generate_title() { - if (page.seo_title) { - return page.seo_title; - } if (page.wiki) { let proj = theme.wiki.tree[page.wiki]; let wiki = (proj && proj.name) || page.wiki; diff --git a/layout/_partial/main/article/article_footer.ejs b/layout/_partial/main/article/article_footer.ejs index 64654a8..d22dc69 100644 --- a/layout/_partial/main/article/article_footer.ejs +++ b/layout/_partial/main/article/article_footer.ejs @@ -98,7 +98,7 @@ function layoutDiv() { el += ' onclick="util.toggle("qrcode-wechat")"'; } else if (item == 'weibo') { el += ' href="https://service.weibo.com/share/share.php?url=' + page.permalink; - el += '&title=' + (page.seo_title || (page.title + ' - ' + config.title)); + el += '&title=' + page.title + ' - ' + config.title; if (page.layout == 'post' && page.cover) { el += '&pics=' + page.cover; } else if (page.layout == 'wiki' && page.icon) { @@ -107,7 +107,7 @@ function layoutDiv() { el += '&summary=' + truncate(page.description || strip_html(page.excerpt || page.content), {length: 120}); el += '"'; } else if (item == 'email') { - el += ' href="mailto:?subject=' + ((page.title + ' - ' + config.title) || page.seo_title) + '&' + el += ' href="mailto:?subject=' + page.title + ' - ' + config.title + '&' el += 'body=' + page.permalink + '"'; } else if (item == 'link') { el += ' onclick="util.copy("copy-link", "' + __('message.copied') + '")"'; diff --git a/layout/_partial/main/article/read_next.ejs b/layout/_partial/main/article/read_next.ejs index 4b87957..da93097 100644 --- a/layout/_partial/main/article/read_next.ejs +++ b/layout/_partial/main/article/read_next.ejs @@ -40,7 +40,7 @@ function layoutDiv() { if (prev) { el += '
' + title_prev + '
'; el += ''; - el += prev.title || prev.seo_title || prev.wiki || date(prev.date, config.date_format); + el += prev.title || prev.wiki || date(prev.date, config.date_format); el += ''; } el += ''; @@ -49,7 +49,7 @@ function layoutDiv() { if (next) { el += '
' + title_next + '
'; el += ''; - el += next.title || next.seo_title || next.wiki || date(next.date, config.date_format); + el += next.title || next.wiki || date(next.date, config.date_format); el += ''; } el += ''; diff --git a/layout/_partial/main/navbar/breadcrumb.ejs b/layout/_partial/main/navbar/breadcrumb.ejs index 671ea9c..70c4694 100644 --- a/layout/_partial/main/navbar/breadcrumb.ejs +++ b/layout/_partial/main/navbar/breadcrumb.ejs @@ -136,14 +136,14 @@ function layoutDiv() { `; } el += ''; - } else if (page.title || page.seo_title) { + } else if (page.title) { el += `
diff --git a/layout/_partial/main/post_list/post_card.ejs b/layout/_partial/main/post_list/post_card.ejs index a17dca3..86bf456 100755 --- a/layout/_partial/main/post_list/post_card.ejs +++ b/layout/_partial/main/post_list/post_card.ejs @@ -46,7 +46,7 @@ function div_default() { // 标题 el += '

'; - el += (post.title || post.seo_title) ? (post.title || post.seo_title) : date(post.date, config.date_format); + el += post.title ? post.title : date(post.date, config.date_format); el += '

'; // 摘要 diff --git a/layout/_partial/plugins/comments/artalk/script.ejs b/layout/_partial/plugins/comments/artalk/script.ejs index 84f2a8b..255c1bc 100644 --- a/layout/_partial/plugins/comments/artalk/script.ejs +++ b/layout/_partial/plugins/comments/artalk/script.ejs @@ -11,7 +11,7 @@ var artalk = Artalk.init({ el: '#artalk_container', pageKey: path, - pageTitle: '<%= page.title || page.seo_title %>', + pageTitle: '<%= page.title %>', server: '<%= theme.comments.artalk.server %>', placeholder: '<%= theme.comments.artalk.placeholder %>', site: '<%= config.title %>', diff --git a/layout/_partial/widgets/recent.ejs b/layout/_partial/widgets/recent.ejs index c97658f..432e2a0 100644 --- a/layout/_partial/widgets/recent.ejs +++ b/layout/_partial/widgets/recent.ejs @@ -39,7 +39,7 @@ function layoutDiv() { el += '' + name + '' + ''; } } - el += (post.title || post.seo_title || post.wiki) + ''; + el += (post.title || post.wiki) + ''; if (isActive) { el += `` } diff --git a/scripts/events/lib/doc_tree.js b/scripts/events/lib/doc_tree.js index 34416f9..d585404 100644 --- a/scripts/events/lib/doc_tree.js +++ b/scripts/events/lib/doc_tree.js @@ -9,7 +9,6 @@ class WikiPage { this.id = page._id this.wiki = page.wiki this.title = page.title - this.seo_title = page.seo_title this.path = page.path this.path_key = page.path.replace('.html', '') this.layout = page.layout diff --git a/scripts/events/lib/merge_posts.js b/scripts/events/lib/merge_posts.js index e431f61..c671b8c 100644 --- a/scripts/events/lib/merge_posts.js +++ b/scripts/events/lib/merge_posts.js @@ -11,7 +11,6 @@ class RelatedPage { this.wiki = page.wiki this.topic = page.topic this.title = page.title - this.seo_title = page.seo_title this.path = page.path this.path_key = page.path.replace('.html', '') this.layout = page.layout diff --git a/scripts/tags/lib/toc.js b/scripts/tags/lib/toc.js index 8a267b4..a9792dc 100644 --- a/scripts/tags/lib/toc.js +++ b/scripts/tags/lib/toc.js @@ -14,7 +14,7 @@ function layoutDocTree(ctx, pages) { pages.forEach((p, i) => { el += '
  • ' el += '' - el += '' + (p.title || p.seo_title) + '' + el += '' + p.title + '' el += '' el += '
  • ' })