Draft article
Published 26 February 2020, 26 words, 1-minute read
This is a draft article.
It will never appear in the site unless the publish
front-matter is set to published
or a date which has passed.
diff --git a/build.js b/build.js index a9e8899..eec402c 100644 --- a/build.js +++ b/build.js @@ -20,7 +20,7 @@ siteMeta = { desc: 'dashdevs-suite metalsmith website', author: 'dashdevs', contact: 'https://chat.dashdevs.org', - domain: devBuild ? 'http://127.0.0.1' : 'https://rawgit.com', // set domain + domain: devBuild ? 'http://127.0.0.1' : 'https://dashdev-suite.github.io', // set domain rootpath: devBuild ? null : '/dashdev-website/build/' // set absolute path (null for relative) // root: devBuild ? null : '/build' // TODO: not working?, but also not needed }; @@ -40,11 +40,12 @@ var markdown = require('metalsmith-markdown'); var markdownPrecompiler = require('metalsmith-markdown-precompiler'); var collections = require('metalsmith-collections'); var permalinks = require('metalsmith-permalinks'); -var inplace = require('metalsmith-in-place'); +var publish = require('metalsmith-publish'); var layouts = require('metalsmith-layouts'); var discoverPartials = require('metalsmith-discover-partials'); var paths = require('metalsmith-paths'); var sitemap = require('metalsmith-sitemap'); +var rssfeed = require('metalsmith-feed'); var assets = require('metalsmith-assets'); var wordcount = require("metalsmith-word-count"); @@ -66,6 +67,7 @@ var metalsmith = Metalsmith(__dirname) .source(dir.source + 'html/') // source folder (src/) .destination(dir.dest) // build folder (build/) .metadata(siteMeta) // add meta data to every page + .use(publish()) // draft, private, future-dated .use(discoverPartials({ // needed for markdownPrecompiler directory: 'partials', pattern: /\.hbs$/ // original partials .html but exactly these parameters work @@ -149,7 +151,13 @@ if (browsersync) metalsmith.use(browsersync({ // start test server metalsmith .use(sitemap({ // generate sitemap.xml hostname: siteMeta.domain + (siteMeta.rootpath || ''), - omitIndex: true + omitIndex: true // replace any paths ending in index.html with ''. Useful when you're using metalsmith-permalinks. + })) + .use(rssfeed({ // generate RSS feed for articles + collection: 'article', + site_url: siteMeta.domain + (siteMeta.rootpath || ''), + title: siteMeta.name, + description: siteMeta.desc })) .use(assets({ // copy assets: CSS, images etc. source: dir.source + 'assets/', diff --git a/build/article/draft/index.html b/build/article/draft/index.html deleted file mode 100644 index ca317b6..0000000 --- a/build/article/draft/index.html +++ /dev/null @@ -1 +0,0 @@ -
Published 26 February 2020, 26 words, 1-minute read
This is a draft article.
It will never appear in the site unless the publish
front-matter is set to published
or a date which has passed.
Published 1 March 2016, 16 words, 1-minute read
This article will only appear if the site is built is run after 1 March, 2016.
Published 1 March 2016, 16 words, 1-minute read
This article will only appear if the site is built is run after 1 March, 2016.
Published 10 March 2016, 127 words, 1-minute read
Not everything is necessarily straight-forward in the Metalsmith world…
Some plugins clash with another. For example, metalsmith-rootpath which calculates relative roots does not play nicely with metalsmith-permalinks which creates custom folder structures.
Note: lib/metalsmith-moremeta
in this project sets a correct root
variable whether permalinks are used or not.
One plugins may depend on another or conflict if placed the wrong way around. For example, the RSS-generating metalsmith-feed plugin must be called after metalsmith-layouts to ensure rss.xml
is not generated within a page template.
When Browsersync is running and files are edited, collections are re-parsed but the old data remains. This can cause menus and next/back links to be incorrect. To fix this, stop and restart the build.
Published 10 March 2016, 127 words, 1-minute read
Not everything is necessarily straight-forward in the Metalsmith world…
Some plugins clash with another. For example, metalsmith-rootpath which calculates relative roots does not play nicely with metalsmith-permalinks which creates custom folder structures.
Note: lib/metalsmith-moremeta
in this project sets a correct root
variable whether permalinks are used or not.
One plugins may depend on another or conflict if placed the wrong way around. For example, the RSS-generating metalsmith-feed plugin must be called after metalsmith-layouts to ensure rss.xml
is not generated within a page template.
When Browsersync is running and files are edited, collections are re-parsed but the old data remains. This can cause menus and next/back links to be incorrect. To fix this, stop and restart the build.
Further Gulp tasks can then be added. Note .clean(false)
ensures Metalsmith never wipes the build folder when other tasks are active.
There are a number of Gulp/Metalsmith integration plugins although they are rarely necessary.