diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-05-22 10:47:12 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-05-22 10:47:12 -0300 |
commit | 3b542d286f66e54cb10507fb196a61b7b2f1ee94 (patch) | |
tree | 56b41222616beea55d1cb15278e3d07de987b08a | |
parent | 5f2d40478a5e50031db3a3cb48f39f6b1e2b9ef5 (diff) |
wiki short name in page/tab title data-restructure
-rw-r--r-- | src/page/homepage.js | 1 | ||||
-rw-r--r-- | src/strings-default.json | 2 | ||||
-rwxr-xr-x | src/upd8.js | 9 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/page/homepage.js b/src/page/homepage.js index b20fc812..534ce78b 100644 --- a/src/page/homepage.js +++ b/src/page/homepage.js @@ -29,6 +29,7 @@ export function writeTargetless({wikiData}) { transformMultiline }) => ({ title: wikiInfo.name, + showWikiNameInTitle: false, meta: { description: wikiInfo.description diff --git a/src/strings-default.json b/src/strings-default.json index f1a53027..9ece6a8e 100644 --- a/src/strings-default.json +++ b/src/strings-default.json @@ -151,6 +151,8 @@ "misc.nav.next": "Next", "misc.nav.info": "Info", "misc.nav.gallery": "Gallery", + "misc.pageTitle": "{TITLE}", + "misc.pageTitle.withWikiName": "{TITLE} | {WIKI_NAME}", "misc.skippers.skipToContent": "Skip to content", "misc.skippers.skipToSidebar": "Skip to sidebar", "misc.skippers.skipToSidebar.left": "Skip to sidebar (left)", diff --git a/src/upd8.js b/src/upd8.js index 63d36b0a..394af80e 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -848,6 +848,8 @@ writePage.html = (pageInfo, { theme = '', stylesheet = '', + showWikiNameInTitle = true, + // missing properties are auto-filled, see below! body = {}, banner = {}, @@ -1086,7 +1088,12 @@ writePage.html = (pageInfo, { 'data-rebase-data': to('data.root') })}> <head> - <title>${title}</title> + <title>${(showWikiNameInTitle + ? language.formatString('misc.pageTitle.withWikiName', { + title, + wikiName: wikiInfo.nameShort + }) + : language.formatString('misc.pageTitle', {title}))}</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> ${Object.entries(meta).filter(([ key, value ]) => value).map(([ key, value ]) => `<meta ${key}="${html.escapeAttributeValue(value)}">`).join('\n')} |