From 7c9847e97c03ecd535b93008749a371d7a7830f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Sun, 7 Apr 2024 23:16:51 +0900 Subject: [PATCH] fix: `canonical` of pages without `permalink` is the `en` version --- scripts/helpers.js | 2 +- themes/navy/layout/partial/head.njk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/helpers.js b/scripts/helpers.js index 7eb267641a..1d082fc54b 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -83,7 +83,7 @@ hexo.extend.helper.register('header_menu', function(className) { hexo.extend.helper.register('canonical_url', function(lang) { const slugs = this.page.path.split('/').filter(v => v !== ''); - if (Object.keys(this.site.data.languages).includes(slugs.at(0))) { + if (Object.keys(this.site.data.languages).includes(slugs[0])) { slugs.shift(); } if (lang !== 'en') { diff --git a/themes/navy/layout/partial/head.njk b/themes/navy/layout/partial/head.njk index 34ff677165..557ee4339c 100644 --- a/themes/navy/layout/partial/head.njk +++ b/themes/navy/layout/partial/head.njk @@ -4,7 +4,7 @@ - + {% if page.layout == 'page' or page.layout == 'index' %} {% for lang, value in site.data.languages %}