From e943484cf46cfe509b8d68fada06a760ae05545f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 24 Apr 2022 21:53:10 -0300 Subject: add language tags --- src/upd8.js | 52 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/src/upd8.js b/src/upd8.js index 5908bc2d..14471186 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -820,6 +820,7 @@ writePage.to = ({ }; writePage.html = (pageFn, { + localizedPaths, paths, strings, to, @@ -881,6 +882,13 @@ writePage.html = (pageFn, { ? wikiInfo.canonicalBase + (paths.pathname === '/' ? '' : paths.pathname) : ''); + const localizedCanonical = (wikiInfo.canonicalBase + ? Object.entries(localizedPaths).map(([ code, { pathname } ]) => ({ + lang: code, + href: wikiInfo.canonicalBase + (pathname === '/' ? '' : pathname) + })) + : []); + const collapseSidebars = (sidebarLeft.collapse !== false) && (sidebarRight.collapse !== false); const mainHTML = main.content && html.tag('main', { @@ -1061,6 +1069,7 @@ writePage.html = (pageFn, { ${Object.entries(meta).filter(([ key, value ]) => value).map(([ key, value ]) => ``).join('\n')} ${canonical && ``} + ${localizedCanonical.map(({ lang, href }) => ``).join('\n')} ${(theme || stylesheet) && fixWS`