diff --git a/CHANGELOG.md b/CHANGELOG.md index b261a2f..eac679a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ unreleased significant changes for end users: +* allow to set additional meta tags via the `meta` configuration: + * expects an object, with the keys being the `name` and the values being the `content` * we no longer bundle the --serve and --live-serve dependencies - you will be asked to install them * reduce faucet dependencies * update all dependencies diff --git a/example/aiur.config.js b/example/aiur.config.js index 0b99775..c95cb84 100644 --- a/example/aiur.config.js +++ b/example/aiur.config.js @@ -2,6 +2,9 @@ exports.title = "Example Styleguide"; exports.language = "en"; +exports.meta = { + robots: "noindex" +}; exports.vendor = { styles: [{ diff --git a/lib/generate_layout.js b/lib/generate_layout.js index f59809e..c56246e 100644 --- a/lib/generate_layout.js +++ b/lib/generate_layout.js @@ -9,6 +9,7 @@ module.exports = async (navigation, manifest) => { ${page.title || ""} + ${page.meta} diff --git a/lib/page.js b/lib/page.js index efd9088..12771be 100644 --- a/lib/page.js +++ b/lib/page.js @@ -2,11 +2,11 @@ let { repr } = require("faucet-pipeline-core/lib/util"); let colonParse = require("metacolon"); module.exports = class Page { - constructor(slug, sourcePath, children, { language, title, description }, dataPath) { + constructor(slug, sourcePath, children, { language, title, description, meta }, dataPath) { this.slug = slug || ""; this.sourcePath = sourcePath; this.children = children || null; - this.config = { language, title, description }; + this.config = { language, title, description, meta }; this.dataPath = dataPath; } @@ -27,6 +27,7 @@ module.exports = class Page { this.heading = headers.title; this.title = [headers.title, this.config.title].filter(x => x).join(" | "); this.description = headers.description || this.config.description; + this.meta = this.buildMeta(); this.status = headers.status; this.version = headers.version; this.tags = headers.tags; @@ -34,6 +35,10 @@ module.exports = class Page { return this; } + buildMeta() { + return Object.entries(this.config.meta || {}).map(x => ``).join("\n"); + } + toString() { let filepath = repr(this.sourcePath, false); let suffix = this.body ? " resolved" : ""; diff --git a/test/expectations/atoms/button/index.html b/test/expectations/atoms/button/index.html index da34d60..d4583ef 100644 --- a/test/expectations/atoms/button/index.html +++ b/test/expectations/atoms/button/index.html @@ -5,6 +5,7 @@ Button + diff --git a/test/expectations/atoms/index.html b/test/expectations/atoms/index.html index 39a8742..8b19f2d 100644 --- a/test/expectations/atoms/index.html +++ b/test/expectations/atoms/index.html @@ -5,6 +5,7 @@ Atoms + diff --git a/test/expectations/atoms/strong/index.html b/test/expectations/atoms/strong/index.html index 474d0fb..e1783a8 100644 --- a/test/expectations/atoms/strong/index.html +++ b/test/expectations/atoms/strong/index.html @@ -5,6 +5,7 @@ strong + diff --git a/test/expectations/index.html b/test/expectations/index.html index c4ffbb5..b19b21d 100644 --- a/test/expectations/index.html +++ b/test/expectations/index.html @@ -5,6 +5,7 @@ My Style Guide + diff --git a/test/fixtures/aiur.config.js b/test/fixtures/aiur.config.js index 92230a1..0883be9 100644 --- a/test/fixtures/aiur.config.js +++ b/test/fixtures/aiur.config.js @@ -1,5 +1,9 @@ "use strict"; +exports.meta = { + robots: "noindex" +}; + exports.pages = { "": "./welcome.md", atoms: {