From 1f95e0ebabd7396cc8b8bb9514a54de6993874fe Mon Sep 17 00:00:00 2001 From: justaLoli <92238102+justaLoli@users.noreply.github.com> Date: Thu, 19 Nov 2026 09:07:30 +0800 Subject: [PATCH] feat(head): generate page meta tags with open_graph - replace hard-coded description and keywords meta with open_graph() - keep the keywords meta only when page or site keywords are set - use page cover fields as the share image via getPostCoverUrl() - add a canonical link - output the title on a single line --- layout/_partial/head.ejs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index 411b9f98..944ccdc0 100644 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -1,9 +1,6 @@ - - - <% let title = page.title; if (is_archive()) { @@ -21,12 +18,18 @@ title = __(page.title); } %> - - <% if (title) { %> - <%= title %> | - <% } %> - <%= theme?.base_info?.title || config?.title || 'Keep Theme' %> - + <% + const ogOptions = { title: title || config.title } + const cover = page?.cover || page?.post_cover || page?.page_cover || page?.home_cover + if (cover) ogOptions.image = getPostCoverUrl(page, cover) + %> + <%- open_graph(ogOptions) %> + <% if (page?.keywords || config?.keywords) { %> + + <% } %> + + + <%= title ? title + ' | ' : '' %><%= theme?.base_info?.title || config?.title || 'Keep Theme' %> <%- css('css/style') %> <% if (theme?.base_info?.favicon) { %> <%- favicon_tag(theme?.base_info?.favicon) %>