« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/things.js10
-rw-r--r--src/misc-templates.js2
-rwxr-xr-xsrc/upd8.js6
3 files changed, 16 insertions, 2 deletions
diff --git a/src/data/things.js b/src/data/things.js
index b4737510..daec610c 100644
--- a/src/data/things.js
+++ b/src/data/things.js
@@ -1466,6 +1466,16 @@ Language.propertyDescriptors = {
         }
     },
 
+    // Flag which represents whether or not to hide a language from general
+    // access. If a language is hidden, its portion of the website will still
+    // be built (with all strings localized to the language), but it won't be
+    // included in controls for switching languages or the <link rel=alternate>
+    // tags used for search engine optimization. This flag is intended for use
+    // with languages that are currently in development and not ready for
+    // formal release, or which are just kept hidden as "experimental zones"
+    // for wiki development or content testing.
+    hidden: Thing.common.flag(false),
+
     // Mapping of translation keys to values (strings). Generally, don't
     // access this object directly - use methods instead.
     strings: {
diff --git a/src/misc-templates.js b/src/misc-templates.js
index d3817500..f40229d1 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -479,7 +479,7 @@ export function getFooterLocalizationLinks(pathname, {
     const toArgs = toPath.slice(1);
 
     const links = Object.entries(languages)
-        .filter(([ code ]) => code !== 'default')
+        .filter(([ code, language ]) => code !== 'default' && !language.hidden)
         .map(([ code, language ]) => language)
         .sort(({ name: a }, { name: b }) => a < b ? -1 : a > b ? 1 : 0)
         .map(language => html.tag('span', html.tag('a', {
diff --git a/src/upd8.js b/src/upd8.js
index b2f5aa0b..4d51d7f7 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -1332,6 +1332,9 @@ async function processLanguageFile(file) {
     }
     delete json['meta.languageName'];
 
+    const hidden = json['meta.hidden'] ?? false;
+    delete json['meta.hidden'];
+
     if (json['meta.baseDirectory']) {
         logWarn`(${code}) Language JSON still has unused meta.baseDirectory`;
         delete json['meta.baseDirectory'];
@@ -1341,6 +1344,7 @@ async function processLanguageFile(file) {
     language.code = code;
     language.intlCode = intlCode;
     language.name = name;
+    language.hidden = hidden;
     language.escapeHTML = string => he.encode(string, {useNamedReferences: true});
     language.strings = json;
     return language;
@@ -1972,7 +1976,7 @@ async function main() {
                 const directory = path[1];
 
                 const localizedPaths = Object.fromEntries(Object.entries(languages)
-                    .filter(([ key ]) => key !== 'default')
+                    .filter(([ key, language ]) => key !== 'default' && !language.hidden)
                     .map(([ key, language ]) => [language.code, writePage.paths(
                         (language === finalDefaultLanguage ? '' : language.code),
                         'localized.' + pageSubKey,