.use(function (pages, metalsmith, done) { if (modifiedFiles === null) { sitemap({ hostname: 'http://www.mograblog.com', pattern: ['**/*.html', '!*.html', '!**/drafts/**/*.html', '!**/fonts/**/*.html'] })(pages, metalsmith, done) } else { done() } })
.use(templates({ engine: 'handlebars', directory: 'templates', partials: { nav: 'partials/nav', archive: 'partials/archive', header: 'partials/header', footer: 'partials/footer' } })) /** * Build sitemap */ .use(sitemap({ output: 'sitemap.xml', hostname: info.url })) /** * Create robots.txt */ .use(robots({ "useragent": "*", "allow": ["/"], "sitemap": info.url + "/sitemap.xml" })) /** * Set build destination */ .destination('./build')
site: function(done) { metalsmith(__dirname + '/../') .clean(false) .source('./src/documents_' + lang) .metadata(require('../config.js')(lang, isStaging)) .use(draft()) .use(require('./helpers')()) .use(require('./import-api-docs')(lang)) .use(require('./patterns-collection')(lang)) .use(collections({ components: { sortBy: 'name' }, objects: { sortBy: 'name' }, guides: { sortBy: 'name' } })) .use(function(files, metalsmith, done) { setImmediate(done); var dict = {}; for (var path in files) { var file = files[path]; if (file.componentCategory) { file.componentCategory.split(/, */).forEach(function(category) { if (!dict[category]) { dict[category] = []; } dict[category].push(file); }); } } metalsmith.metadata().componentCategoryDict = sortObject(dict); }) .use(templates({engine: 'eco', inPlace: true})) .use(require('./autotoc')()) .use(function(files, metalsmith, done) { setImmediate(done); var cssFile = files['reference/css.html']; var cssToc = cssFile.toc; delete cssFile.toc; metalsmith.metadata().cssToc = cssToc; }) .use(currentPath()) .use(branch('!robots.txt') .use(layouts({ engine: 'eco', directory: './src/layouts/', default: 'default.html.eco' })) ) .use(assets({source: './src/files'})) .use(require('./css-transform')(lang)) .use(redirect({ '/components.html' : '/reference/javascript.html', '/guide/components.html' : '/reference/javascript.html' })) .use(branch('*.html').use(currentPath())) .use(function(files, metalsmith, done) { setImmediate(done); for (var file in files) { if (file.match(/\.html$/)) { files[file].path = file; } } }) .use(branch('robots.txt').use(templates({ inPlace: true, engine: 'eco' }))) .use(sitemap({ ignoreFiles: [/\.gitignore/], output: 'sitemap.xml', hostname: 'http://' + (isStaging ? 's.' : '') + (lang === 'ja' ? 'ja.' : '') + 'onsen.io', defaults: { priority: 0.5 } })) .destination('./out_' + lang) .build(function(error) { if (error) { gutil.log('ERROR: ' + error); if (error.stack) { gutil.log(error.stack); } } browserSync.reload(); gutil.log('Generated into \'./out_' + lang + '\''); done(); }); },
blog: function(done) { if (lang === 'ja') { done(); return; } metalsmith(__dirname + '/../') .clean(false) .source('./blog/posts/') .destination('./out_en/blog/') .metadata(require('../config.js')('en')) .use(function(files, metalsmith, done) { setImmediate(done); metalsmith.metadata().isBlog = true; var site = metalsmith.metadata().site; site.url = site.url + '/blog/'; }) .use(draft()) .use(require('./helpers')()) .use(collections({ articles: { pattern: '*.markdown', sortBy: 'date', reverse: true } })) .use(branch('*.markdown') // articles .use(markdown({ gfm: true, tables: true, breaks: false, pedantic: false, sanitize: false, smartLists: true, smartypants: true })) .use(permalinks({ pattern: ':id' })) .use(function(files, metalsmith, done) { var authors = metalsmith.metadata().env.authors; for (var path in files) { var doc = files[path]; var authorName = doc.author; if (!doc.author) { throw new Error('@author is undefined: ' + path); } doc.isArticle = true; doc.author = authors[doc.author]; if (!doc.author) { throw new Error('no such author: ' + authorName); } } done(); }) .use(function(files, metalsmith, done) { for (var path in files) { files[path].isBlogArticle = true; } done(); }) ) .use(branch('*.html') // index page .use(paginate({ perPage: 4, path: 'blog' })) .use(currentPath()) .use(templates({inPlace: true, engine: 'eco'})) ) .use(metalsmithDebug()) .use(feed({ collection: 'articles', limit: 10, destination: 'rss.xml', feedOptions: { title: 'Onsen UI Blog', url: 'http://onsen.io/' } })) .use(branch('!rss.xml') .use(currentPath()) .use(layouts({ engine: 'eco', directory: './src/layouts/', default: 'blog.html.eco' })) ) .use(assets({ source: './blog/content', destination: './content' })) .use(sitemap({ output: 'sitemap.xml', hostname: 'http://' + (isStaging ? 's.' : '') + (lang === 'ja' ? 'ja.' : '') + 'onsen.io/blog/', defaults: { priority: 0.5 } })) .build(function(error) { if (error) { gutil.log('ERROR: ' + error); } done(); }); }
.use(cleanCSS({ rebase: true })) .use(permalinks({ relative: false })) .use(function(files, metalsmith, done) { files['index.html'].isIndex = true; done(); }) .use(layouts({ engine: 'handlebars', })) .use(rollup({ entry: 'index.js', sourceMap: true, plugins: [ nodeResolve(), commonjs(), babel(), uglify() ] })) .use(htmlMinifier()) .use(sitemap({ hostname: 'http://argeli.us' })) .build(function(err, files) { if (err) { throw err; } });
blog: function(done) { if (lang === 'ja') { done(); return; } metalsmith(__dirname + '/../') .clean(false) .source('./blog/posts/') .destination('./out_en/blog/') .metadata(require('../config.js')('en')) .use(function(files, metalsmith, done) { setImmediate(done); metalsmith.metadata().isBlog = true; var site = metalsmith.metadata().site; site.url = site.url + '/blog/'; }) .use(draft()) .use(require('./helpers')()) .use(collections({ articles: { pattern: '*.markdown', sortBy: 'date', reverse: true } })) .use(branch('*.markdown') // articles .use(function(files, metalsmith, done) { for (var path in files) { var doc = files[path]; doc.markdownContents = doc.contents.toString('utf8'); doc.numericId = crypto.createHash('md5').update(doc.id).digest('hex'); doc.cid = 7; } done(); }) .use(markdown({ gfm: true, tables: true, breaks: false, pedantic: false, sanitize: false, smartLists: true, smartypants: true })) .use(permalinks({ pattern: ':id' })) .use(function(files, metalsmith, done) { var authors = metalsmith.metadata().env.authors; for (var path in files) { var doc = files[path]; var authorName = doc.author; if (!doc.author) { throw new Error('@author is undefined: ' + path); } doc.isArticle = true; doc.author = authors[doc.author]; doc.origContents = doc.contents; if (!doc.author) { throw new Error('no such author: ' + authorName); } } done(); }) .use(function(files, metalsmith, done) { for (var path in files) { files[path].isBlogArticle = true; } done(); }) .use(tags({ handle: 'tags', path: 'tags/:tag.html', sortBy: 'date', reverse: true })) .use(wordcloud({ category: 'tags', path: '/blog/tags' })) .use(categories({ handle: 'category', path: 'categories/:category.html' })) .use(function(files, metalsmith, done) { for (var path in files) { var file = files[path]; if (file.tag) { file.title = 'Articles about "' + file.tag + '"'; } file.categories = metalsmith.metadata().env.categories; if (file.isCategory) { var c = file.categories[file.category]; file.title = c.title || c.name || file.category; } } done(); }) ) .use(branch('*.html') // index page .use(paginate({ perPage: 4, path: 'blog' })) .use(currentPath()) .use(templates({inPlace: true, engine: 'eco'})) ) .use(metalsmithDebug()) .use(feed({ collection: 'articles', limit: 10, destination: 'rss.xml', feedOptions: { title: 'The Official Onsen UI Framework Blog', url: 'http://onsen.io/' } })) .use(branch('!rss.xml') .use(currentPath()) .use(layouts({ engine: 'eco', directory: './src/layouts/', default: 'blog.html.eco' })) ) .use(assets({ source: './blog/content', destination: './content' })) .use(sitemap({ output: 'sitemap.xml', hostname: 'http://' + (isStaging ? 's.' : '') + (lang === 'ja' ? 'ja.' : '') + 'onsen.io/blog/', defaults: { priority: 0.5 } })) .build(function(error) { if (error) { gutil.log('ERROR: ' + error); } done(); }); }
})) .use(markdown()) .use(permalinks()) .use(layouts({ engine: 'handlebars', directory: 'layouts', default: 'default.hbs', partials: 'layouts/partials' })) .use(podcast({ title: 'Hea Tarkvara ja Teised Muinasjutud', description: 'A podcast about everything web and dev related.', feedUrl: 'https://dowdy-elf.netlify.com/podcast.xml', siteUrl: 'https://dowdy-elf.netlify.com', imageUrl: 'https://dowdy-elf.netlify.com/assets/img/podcast-image.jpg', author: 'Nele Sergejeva, Karmen Kukk, Ando Roots, Jaan Pullerits', managingEditor: 'Ando Roots', webMaster: 'Andreas Virkus', language: 'EE-ET', categories: ['web', 'dev'], pattern: 'podcasts/*/*.html', pubDate: podcastFeedDate, ttl: 5 })) .use(sitemap({ hostname: 'https://dowdy-elf.netlify.com' })) .build(function (err) { if (err) throw err; });
export default function (specifiedOptions = {}, callback) { const options = Object.assign({}, DEFAULT_OPTIONS, specifiedOptions); // Config // -------------------------------------------------------------------------- const m = Metalsmith(path.resolve(__dirname, '..')); // Metalsmith Config // -------------------------------------------------------------------------- m.clean(true); if (options.test) { m.destination('tmp'); } else { m.destination('dist'); } m.metadata(options); // File Metadata // -------------------------------------------------------------------------- m.use(metadata(config.metadata)); // Ignores // -------------------------------------------------------------------------- m.use(ignore(config.ignore)); // Definitions // -------------------------------------------------------------------------- m.use(define({moment})); // Attach Collections // -------------------------------------------------------------------------- m.use(collections(config.collections)); // Date // -------------------------------------------------------------------------- m.use(jekyllDates()); // Markdown // -------------------------------------------------------------------------- m.use(markdown(config.markdown)) // Excerpts // -------------------------------------------------------------------------- m.use(excerpts()); // Permalinks // -------------------------------------------------------------------------- m.use(permalinks(config.permalinks)); // Pagination // -------------------------------------------------------------------------- m.use(pagination(config.pagination)); // Templates // -------------------------------------------------------------------------- m.use(layouts(config.layouts)); m.use(inPlace(config.inPlace)); // Styles // -------------------------------------------------------------------------- if (options.production) { config.sass.outputStyle = 'compressed'; m.use(sass(config.sass)); } else { m.use(sass(config.sass)); } m.use(autoprefixer()); // Test Fixtures // -------------------------------------------------------------------------- if (options.test) { m.use((files) => { for (let f in files) { if (f.indexOf('.html') !== -1) { files[f].contents = helpers.stripScripts(files[f].contents); } } }); } // Js // -------------------------------------------------------------------------- if (options.production) { m.use(webpack(config.webpackProd)); } else if (options.test) {} else { m.use(webpack(config.webpack)); } // Sitemap // -------------------------------------------------------------------------- if (options.production) { m.use(sitemap(config.sitemap)); } // RSS Feed // -------------------------------------------------------------------------- if (options.production) { m.use(rss(config.rss)); } // Production // -------------------------------------------------------------------------- if (options.production) { m.use(imagemin(config.imagemin)); m.use(htmlMinifier('*.html', config.htmlMinifier)); } // Build // -------------------------------------------------------------------------- m.build(callback); }
gulp.task('dist-metal', function () { return gulp.src([ paths.markdown, paths.variables ]) .pipe(gulp_front_matter()).on("data", function(file) { _.assign(file, file.frontMatter); delete file.frontMatter; }) .pipe( gulpsmith() .use(parseCSV({ name: 'training', path: 'content/training.csv', template: 'training-entry.html', filenameKeys: ['class_title', 'url_date'], contentsKey: 'description', titleKey: 'class_title' })) .use(parseCSV({ name: 'forumtraining', path: 'content/forum-training.csv', template: '2015-forum-training-entry.html', filenameKeys: ['class_title'], contentsKey: 'description', titleKey: 'class_title', additional: function (file) { file.bodyClass = '_2015-forum-training'; return file; } })) .use(parseCSV({ name: 'forumtraining2016', path: 'content/forum-training-2016.csv', template: 'events/texas-gis-forum/2016/2016-forum-training-entry.html', filenameKeys: ['class_title'], contentsKey: 'description', titleKey: 'class_title', additional: function (file) { file.bodyClass = '_2016-forum-training'; return file; } })) .use(parseCSV({ name: 'forumtraining2017', path: 'content/forum-training-2017.csv', template: 'events/texas-gis-forum/2017/2017-forum-training-entry.html', filenameKeys: ['class_title'], contentsKey: 'description', titleKey: 'class_title', mainimage: 'static/images/texas-gis-forum/2017/ourpastinspires-banner-main.jpg', mainimagesm: 'static/images/texas-gis-forum/2017/ourpastinspires-banner-main-sm.jpg', mainimagexs: 'static/images/texas-gis-forum/2017/ourpastinspires-banner-main-sm.jpg', additional: function (file) { file.bodyClass = '_2017-forum-training'; return file; } })) .use(parseCSV({ name: 'forumtraining2018', path: 'content/forum-training-2018.csv', template: 'events/texas-gis-forum/2018/2018-forum-training-entry.html', filenameKeys: ['class_title'], contentsKey: 'description', titleKey: 'class_title', mainimage: 'static/images/texas-gis-forum/2018/forum_2018_growing_sapling_lg.jpg', mainimagesm: 'static/images/front-page/forum_2018_growing_sapling_front_sm.jpg', additional: function (file) { file.bodyClass = '_2018-forum-training'; return file; } })) .use(metadata({ variables: 'variables.yaml' })) .use(each(function(file, filename) { file.filename = filename; file.preserved = filename.slice(0, -1 * path.extname(filename).length); file.id = file.preserved.replace(/\//g, '-'); if (file.id[0].match(/\d/)) { file.id = '_' + file.id; } })) .use(autodate('YYYY-MM-DD')) .use(collector({ pattern: '*.md', ignore: ['training'] })) .use(catalogWriter()) .use(paginate({ perPage: 10, path: 'updates' })) .use(each(function(file) { // run metadata fields through markdown renderer for link processing var markdownFields = [ 'updates', 'instructor_bio' ]; _.each(markdownFields, function(markdownField) { if (file[markdownField]) { if (Array.isArray(file[markdownField])) { file[markdownField] = file[markdownField].map(function (str) { return marked(str, markedOptions); }); } else { file[markdownField] = marked(file[markdownField], markedOptions); } } }); })) .use(each(function(file) { file.contents = '{%- import "_macros.html" as m -%}\n' + file.contents; })) .use(each(function(file) { if (file.filename == '404.md') { file.contents = file.contents+'<script>var a =["*****@*****.**","ryan.jpg","lauren.jpg","joey.jpg","jason.jpg","erik.jpg","david.jpg","adam.jpg","felicia.jpg","gayla.jpg","miguel.jpg","patricia.jpg","richard.jpg","richard_1987.jpg","giscat.jpg","henry.jpg"];var i =a[Math.floor(Math.random()*a.length)];document.getElementById("fourohfour").src="../static/images/404/"+i;</script>' } })) .use(markdown(markedOptions)) .use(each(function(file) { file.urlEnd = file.withoutDate || file.preserved; })) .use(permalinks({ pattern: ':collection/:date/:urlEnd', date: 'YYYY-MM-DD' })) .use(crossref({ include: { 'data-download': '/data-download/' }, includeDirs: { 'static/documents': 'static/documents', 'static/images': 'static/images' } })) .use(based()) .use(replace({ contents: function(contents) { var str = contents.toString() .replace(/{{.+?}}/g, scapegoat.unescape) .replace(/{#.+?#}/g, scapegoat.unescape) .replace(/{%.+?%}/g, scapegoat.unescape); return new Buffer(str); } })) .use(function (files, metalsmith, done) { // combine news and geographic information office into an updates stream var updates = metalsmith.data.news.concat(metalsmith.data.geographic_information_office_news); metalsmith.data.updates = _.sortBy(updates, 'date').reverse(); done(); }) .use(templates({ engine: 'swig', inPlace: true })) .use(templates({ engine: 'swig' })) .use(sitemap({ hostname: 'https://tnris.org', output: 'sitemap-main.xml' })) .use(function (files, metalsmith, done) { if (errors.count > 0) { clog.error("There were " + errors.count + " errors with this build. You'll need to fix them before continuing."); process.exit(1); } else { clog.info('Build is clean! Hurray!'); } done(); }) ) .pipe(gulp.dest(dirs.tmp)); });
site: function(done) { metalsmith(__dirname + '/../') .clean(false) .source('./src/documents_' + lang) .metadata(require('../config.js')(lang, isStaging)) .use(draft()) .use(require('./helpers')()) .use(require('./v1-api-docs')(lang)) .use(require('./v2-wc-api-docs')(lang, 'js')) .use(require('./v2-wc-api-docs')(lang, 'angular1')) .use(require('./v2-wc-api-docs')(lang, 'angular2')) .use(require('./v2-react-api-docs')(lang)) .use(require('./patterns-collection')(lang, __dirname + '/../dist/v2/OnsenUI/css-components/www/patterns')) .use(collections({ components: { sortBy: 'name' }, objects: { sortBy: 'name' }, guides: { sortBy: 'name' } })) .use(require('./docs-categories.js')(lang)) .use(templates({engine: 'eco', inPlace: true})) .use(require('./autotoc')()) .use(function(files, metalsmith, done) { setImmediate(done); var cssFile = files['v2' + nodePath.sep + 'docs' + nodePath.sep + 'css.html']; if (cssFile && cssFile.toc) { var cssToc = cssFile.toc; delete cssFile.toc; } metalsmith.metadata().cssToc = cssToc; }) .use(currentPath()) .use(branch('!robots.txt') .use(layouts({ engine: 'eco', directory: './src/layouts/', default: 'default.html.eco' })) ) .use(assets({source: './src/files'})) .use(assets({source: './dist/v1/OnsenUI/build', destination: 'v1/OnsenUI'})) .use(assets({source: './dist/v2/OnsenUI/build', destination: 'v2/OnsenUI'})) .use(assets({source: './dist/tutorial', destination: 'tutorial'})) .use(require('./css-transform')(lang)) .use(branch('*.html').use(currentPath())) .use(function(files, metalsmith, done) { setImmediate(done); for (var file in files) { if (file.match(/\.html$/)) { files[file].path = file; } } }) .use(branch('robots.txt').use(templates({ inPlace: true, engine: 'eco' }))) .use(redirect(require("./redirect_rule.json")[lang])) .use(sitemap({ ignoreFiles: [/\.gitignore/], output: 'sitemap.xml', hostname: 'http://' + (isStaging ? 's.' : '') + (lang === 'ja' ? 'ja.' : '') + 'onsen.io', defaults: { priority: 0.5 } })) .destination('./out_' + lang) .build(function(error) { if (error) { gutil.log('ERROR: ' + error); if (error.stack) { gutil.log(error.stack); } } browserSync.reload(); gutil.log('Generated into \'./out_' + lang + '\''); done(); }); },
function build() { new Metalsmith(__dirname) // Disable default metalsmith directory cleaning .clean(false) //Additional global data .metadata({ // Production environment 'prod': prod_env, // Site info 'site-title': [ site.title ], 'site-description': [ site.description ] }) // Get each piece of work and store in an array for use in templates // Use "collection" metadata inside markdown files rather than by pattern to avoid odd sort bugs .use(collections({ work: { sortBy: 'order' } })) // Ignore readme .use(ignore([ 'README.md' ])) // Process markdown .use(markdown()) // Build permalink folder structure .use(permalinks({ pattern: 'work/:title', relative: true, })) // Process handlebar templates .use(templates({ engine: 'handlebars', directory: paths.src + '/' + paths.templates })) // Ignore folders .use(ignore([ paths.templates + '/**', paths.work + '/**', paths.js + '/**', paths.scss + '/**', paths.svg + '/**' ])) // Minify html .use(msIf(prod_env, minifyHTML())) // Copy readme file .use(copyAssets({ src: 'src/README.md' })) .use(msIf(prod_env, siteMap({ 'hostname': site.url, 'omitIndex': true, 'changefreq': 'daily', 'lastmod': current_date, 'pattern': [ '**/*.html', '**/*.pdf' ] }))) .destination(paths.build) .build(function (err) { if (err) { console.log(err); } else { console.log('Site build complete!'); } }); }
module.exports = () => { return gulpsmith() .metadata(configs) .use(drafts()) .use( collections({ blog: { pattern: 'blog/*/index.md', sortBy: 'datePublished', reverse: true, refer: false, }, }) ) .use( collectionMetadata({ 'collections.blog': { pagetype: 'BlogPosting', }, }) ) .use(posixPath()) .use(jsonMetadata()) .use(inPlace()) .use(markdown()) .use( copy({ pattern: '**/index.html', transform: (file) => file.replace(/index.html$/g, 'index.tpl'), }) ) .use( copy({ pattern: 'blog/*/index.html', transform: (file) => file.replace(/index.html$/g, 'amp.html'), }) ) .use( fileMetadata([ { pattern: '**/index.tpl', metadata: { pagetype: 'Template', }, }, { pattern: 'blog/*/amp.html', metadata: { pagetype: 'Amp', }, }, ]) ) .use( layouts({ engine: 'pug', pattern: ['**/*'], default: 'start.pug', directory: 'src/layouts', }) ) .use( sitemap({ hostname: configs.site.url, urlProperty: 'posixPath', pattern: '**/index.html', }) ) .use(rename([['feed.html', 'feed.xml']])) }
gulp.task('site', () => { Metalsmith('./src') .source('.') .destination('../dist/') .ignore(['_*', '**/_*']) .use(drafts()) .use(collections({ articles: { pattern: 'articles/**.md', sortBy: 'date', reverse: true } })) // .use(inplace({ // engine: 'handlebars', // })) .use(markdown({ smartypants: true, gfm: true, tables: true })) .use(permalink({ linksets: [{ match: {collection: 'articles' }, pattern: ':date/:title' }] })) .use(inplace({ engine: 'handlebars', })) .use((files, metalsmith, done) => { done(); }) .use((files, metalsmith, done) => { const groupedPages = {}; for (let article of metalsmith._metadata.articles) { const date = moment(article.date); // add to year groupedPages[date.year()] = groupedPages[date.year()] || {}; groupedPages[date.year()].data = groupedPages[date.year()].data || []; groupedPages[date.year()].data.push(article); // add to month groupedPages[date.year()][date.month()] = groupedPages[date.year()][date.month()] || {}; groupedPages[date.year()][date.month()].data = groupedPages[date.year()][date.month()].data || []; groupedPages[date.year()][date.month()].data.push(article); // add to date groupedPages[date.year()][date.month()][date.date()] = groupedPages[date.year()][date.month()][date.date()] || {}; groupedPages[date.year()][date.month()][date.date()].data = groupedPages[date.year()][date.month()][date.date()].data || []; groupedPages[date.year()][date.month()][date.date()].data.push(article); } // sort them right for (let year of Object.keys(groupedPages)) { groupedPages[year].data.reverse(); for (let month of Object.keys(groupedPages[year])) { if (month !== 'data') { groupedPages[year][month].data.reverse(); for (let day of Object.keys(groupedPages[year][month])) { if (day !== 'data') { groupedPages[year][month][day].data.reverse(); } } } } } // create files const calendarFiles = {}; for (let year of Object.keys(groupedPages)) { calendarFiles[`${year}/index.html`] = { layout: 'calendarpage.hbs', path: year, contents: new Buffer(''), title: `${year}`, calendararticles: groupedPages[year].data, }; for (let month of Object.keys(groupedPages[year])) { if(month !== 'data') { var urlmonth = parseInt(month)+1; if (urlmonth < 10) { urlmonth = '0' + urlmonth; } calendarFiles[`${year}/${urlmonth}/index.html`] = { layout: 'calendarpage.hbs', path: `${year}/${urlmonth}`, title: `${month}`, contents: new Buffer(''), calendararticles: groupedPages[year][month].data, }; } for (let day of Object.keys(groupedPages[year][month])) { if (day !== 'data') { calendarFiles[`${year}/${urlmonth}/${day}/index.html`] = { layout: 'calendarpage.hbs', path: `${year}/${urlmonth}/${day}`, title: `${day}`, contents: new Buffer(''), calendararticles: groupedPages[year][month][day].data, }; } } } } files = Object.assign(files, calendarFiles); done(); }) .use(navigation({ header: { breadcrumbProperty: 'breadcrumb_path', } })) .use(layouts({ engine: 'handlebars', default: 'default.hbs', directory: '_layouts/', pattern: '**/*.html', //TODO: not applying layout to articles... why you no? })) .use(assets({ source: '../assets', destination: './assets/' })) .use(sitemap({ hostname: 'http://thomasheller.net', changefreq: 'monthly', omitIndex: true, })) .build((e) => { if(e) { throw e; } }); });
.use(metalsmith_clean_css({ files: "src/styles/*.css", cleanCSS: { rebase: true } })) .use(metalsmith_excerpts()) .use(metalsmith_collections({ advertisements: { pattern: 'avoimet-tyopaikat/**.html', sortBy: 'date', reverse: true } })) .use(metalsmith_sitemap({ hostname: "https://www.tkrekry.fi" })) .use(metalsmith_feed({ collection: "advertisements", title: "TKrekry - Lääkärien ja hammaslääkärien työpaikkailmoitukset", description: "Lääkärien ja hammaslääkärien avoimet työpaikat terveyskeskuksissa", site_url: "https://www.tkrekry.fi", destination: "feed/rss.xml", limit: 200, preprocess: (file) => { if (file.url) { return { ...file, url: file.url.replace(/\.pug/, ".html"), title: file.title.replace("Avoimet työpaikat - Työpaikkailmoitus: ", "") };