« get me outta code hell

wiki short name in page/tab title - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
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
commit3b542d286f66e54cb10507fb196a61b7b2f1ee94 (patch)
tree56b41222616beea55d1cb15278e3d07de987b08a
parent5f2d40478a5e50031db3a3cb48f39f6b1e2b9ef5 (diff)
wiki short name in page/tab title data-restructure
-rw-r--r--src/page/homepage.js1
-rw-r--r--src/strings-default.json2
-rwxr-xr-xsrc/upd8.js9
3 files changed, 11 insertions, 1 deletions
diff --git a/src/page/homepage.js b/src/page/homepage.js
index b20fc81..534ce78 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 f1a5302..9ece6a8 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 63d36b0..394af80 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')}