diff --git a/.eleventy.js b/.eleventy.js index af7526d..625173f 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,5 +1,8 @@ module.exports = function (eleventyConfig) { + // https://www.npmjs.com/package/eleventy-plugin-metagen + eleventyConfig.addPlugin(require('eleventy-plugin-metagen')) + // Add filters to Nunjucks eleventyConfig.addFilter("dateDisplay", require("./src/_filters/dates.js") ); diff --git a/package-lock.json b/package-lock.json index ef40f59..7be4a7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@11ty/eleventy": "^0.12.1" + "@11ty/eleventy": "^0.12.1", + "eleventy-plugin-metagen": "^1.5.2" }, "devDependencies": { "gh-pages": "^3.2.3" @@ -850,6 +851,14 @@ "node": ">=0.10.0" } }, + "node_modules/eleventy-plugin-metagen": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/eleventy-plugin-metagen/-/eleventy-plugin-metagen-1.5.2.tgz", + "integrity": "sha512-ZDI1E/866hWvyqyLv8Nzm2X8FY0WdxRv11TxfhX2dgwENRp3qd6/zT3h36SQxpRTE15VAhnbOJRMN0gK/X5dfg==", + "dependencies": { + "@11ty/eleventy": "^0.12.1" + } + }, "node_modules/email-addresses": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", @@ -4302,6 +4311,14 @@ "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz", "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==" }, + "eleventy-plugin-metagen": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/eleventy-plugin-metagen/-/eleventy-plugin-metagen-1.5.2.tgz", + "integrity": "sha512-ZDI1E/866hWvyqyLv8Nzm2X8FY0WdxRv11TxfhX2dgwENRp3qd6/zT3h36SQxpRTE15VAhnbOJRMN0gK/X5dfg==", + "requires": { + "@11ty/eleventy": "^0.12.1" + } + }, "email-addresses": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", diff --git a/package.json b/package.json index 91a5e25..41900e1 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "Eleventy theme based on Bragdoc by Jonny Burch and the team at Progression.app", "main": "index.js", "dependencies": { - "@11ty/eleventy": "^0.12.1" + "@11ty/eleventy": "^0.12.1", + "eleventy-plugin-metagen": "^1.5.2" }, "devDependencies": { "gh-pages": "^3.2.3" diff --git a/src/_data/data.json b/src/_data/data.json index a13332f..ed2a42d 100644 --- a/src/_data/data.json +++ b/src/_data/data.json @@ -1,18 +1,9 @@ { - "site": - { - "name": "11ty x Bragdocs", - "description": "Eleventy theme inspired by Julia Evan's Brag Document. Original Bragdocs design by Jonny Burch and the team at Progression.app.", - "url": "https://emilyyleung.github.io", - "baseUrl": "/eleventy-bragdoc/", - "author": - { - "handle": "@emily_y_leung", - "name": "Emily Y Leung" - }, - "images": - { - "twitter": "https://i.imgur.com/ewfT3Xg.jpg" - } - } + "name": "11ty x Bragdocs", + "description": "Eleventy theme inspired by Julia Evan's Brag Document. Original Bragdocs design by Jonny Burch and the team at Progression.app.", + "url": "https://emilyyleung.github.io", + "baseUrl": "/eleventy-bragdoc/", + "author": "Emily Y Leung", + "twitter_handle": "@emily_y_leung", + "img": "https://i.imgur.com/ewfT3Xg.jpg" } \ No newline at end of file diff --git a/src/_includes/layouts/base.njk b/src/_includes/layouts/base.njk index 26e8531..35c72f3 100644 --- a/src/_includes/layouts/base.njk +++ b/src/_includes/layouts/base.njk @@ -1,10 +1,29 @@ +--- +eleventyComputed: + url_long: '{{ data.url }}{{ data.baseUrl }}' + title_long: '{{ data.author }} / {{ data.name }}' + metagen: + title: '{{ data.name }}' + name: '{{ data.author }}' + desc: '{{ data.description | safe }}' + generator: 'eleventy' + comments: true + url: '{{ url_long }}' + site_name: '{{ title_long }}' + og_title: '{{ title_long }}' + img: '{{ data.img }}' + img_alt: '{{ data.author }}' + twitter_card_type: 'summary_large_image' + twitter_handle: '{{ data.twitter_handle }}' + twitter_title: '{{ title_long }}' +--- - - - - {{ data.name }} + +{% metagen metagen %} +{% include "partials/site-meta-head.njk" %} + @@ -21,8 +40,6 @@ gtag('config', 'G-QHTYKWLREY'); - - {% include "partials/site-meta-head.njk" %} {{ content | safe }} diff --git a/src/_includes/partials/site-foot.html b/src/_includes/partials/site-foot.html index aac4988..6b210a4 100644 --- a/src/_includes/partials/site-foot.html +++ b/src/_includes/partials/site-foot.html @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/src/_includes/partials/site-meta-head.njk b/src/_includes/partials/site-meta-head.njk index 921d8ea..a774f50 100644 --- a/src/_includes/partials/site-meta-head.njk +++ b/src/_includes/partials/site-meta-head.njk @@ -1,28 +1,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + \ No newline at end of file