diff --git a/.spectra/config.js b/.spectra/config.js index 76e425f..da69659 100644 --- a/.spectra/config.js +++ b/.spectra/config.js @@ -24,6 +24,10 @@ module.exports = function(config) { config.addCollection('pages', collection => { return collection.getAllSorted().map(item => { item.outputPath = item.outputPath.toLowerCase(); + item.lowerURL = item.url.toLowerCase(); + return item + }).sort((a, b) => { + return a.lowerURL.localeCompare(b.lowerURL) }); }); diff --git a/.spectra/layout/layout.njk b/.spectra/layout/layout.njk index 330e71a..c68be18 100755 --- a/.spectra/layout/layout.njk +++ b/.spectra/layout/layout.njk @@ -1,24 +1,35 @@ + + + {% if title or metadata.title %} + {{ title or metadata.title }} + {% endif %} + {% if description or metadata.description %} + + {% endif %} - - - - - - - {% if title or metadata.title %} {{ title or metadata.title }} {% endif %} - {% if description or metadata.description %} {% endif %} + + +
{{ content | safe }}
+

Auto-generated index of pages

+ - + \ No newline at end of file diff --git a/lib/spectra.js b/lib/spectra.js index 12b8c7b..6220dc1 100755 --- a/lib/spectra.js +++ b/lib/spectra.js @@ -31,12 +31,19 @@ program const srcDir = path.join(__dirname, "..", ".spectra"); const destDir = path.join(inputDirectory, ".spectra"); const configFile = path.join(inputDirectory, ".spectra", "config.js"); + const indexFile = path.join(inputDirectory, "index.md"); + const indexFileMMD = path.join(inputDirectory, "index.mmd"); if (!fs.existsSync(configFile)) { fs.copySync(srcDir, destDir); console.log(`Created new directory at ${destDir} containing config and layouts`); } + if (!fs.existsSync(indexFile) && !fs.existsSync(indexFileMMD)) { + fs.writeFileSync(indexFile, '# Page Index'); + console.log(`Created new file at ${indexFile} for listing all pages`); + } + console.log(`Converting ${inputDirectory} to ${outputDirectory}`) let elev = new Eleventy(inputDirectory, outputDirectory, {