From 472d3f4375130e87ccc04d52275f7dc08c55c57e Mon Sep 17 00:00:00 2001 From: chris062689 Date: Fri, 5 May 2017 23:44:59 -0400 Subject: [PATCH] Force all wiki links to lowercase, as well as incoming files. --- scripts/wiki/app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/wiki/app.js b/scripts/wiki/app.js index 306c190..ba92478 100644 --- a/scripts/wiki/app.js +++ b/scripts/wiki/app.js @@ -10,8 +10,9 @@ var exec = require('sync-exec'); var inputDirectory = './citra.wiki/'; var outputDirectory = '../../site/content/wiki/'; +// The URL function url(title) { - return '/wiki/' + title.replace(/\s+/g, '-'); + return '/wiki/' + title.replace(/\s+/g, '-').toLowerCase(); } if (fs.existsSync(inputDirectory)) { @@ -75,9 +76,10 @@ fs.readdir(inputDirectory, function(err, items) { // Create the new markdown header for Hugo. let newFileContents = `+++\ntitle = "${title}"\ndate = "${modified.toISOString()}"\n+++\n${cleanData}`; - fs.writeFile(`${outputDirectory}${item}`, newFileContents, function(err) { + let itemOutput = item.toLowerCase(); + fs.writeFile(`${outputDirectory}${itemOutput}`, newFileContents, function(err) { if (err) return logger.error(err); - logger.info(`Wrote file ${item} to filesystem.`); + logger.info(`Wrote file ${itemOutput} to filesystem.`); }); } catch (ex) { logger.error(ex);