mirror of
https://github.com/veggiemonk/awesome-docker.git
synced 2024-12-22 06:05:03 -05:00
fix sitemap build step
This commit is contained in:
parent
2f47b5dbe4
commit
2917fe08a7
35
build.js
35
build.js
@ -2,7 +2,8 @@ const fs = require('fs-extra');
|
||||
const cheerio = require('cheerio');
|
||||
const showdown = require('showdown');
|
||||
const Parcel = require('parcel-bundler');
|
||||
const sm = require('sitemap');
|
||||
// const sm = require('sitemap');
|
||||
const { SitemapStream, streamToPromise } = require('sitemap');
|
||||
|
||||
process.env.NODE_ENV = 'production';
|
||||
|
||||
@ -25,20 +26,6 @@ const WEBSITE_FOLDER = 'website';
|
||||
const indexTemplate = `${WEBSITE_FOLDER}/index.tmpl.html`;
|
||||
const indexDestination = `${WEBSITE_FOLDER}/index.html`;
|
||||
|
||||
const sitemapOpts = {
|
||||
hostname: 'https://awesome-docker.netlify.com/',
|
||||
cacheTime: 6000000, // 600 sec (10 min) cache purge period
|
||||
urls: [
|
||||
{
|
||||
url: '/',
|
||||
changefreq: 'daily',
|
||||
priority: 0.8,
|
||||
lastmodrealtime: true,
|
||||
lastmodfile: 'dist/index.html',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async function processIndex() {
|
||||
const converter = new showdown.Converter({
|
||||
omitExtraWLInCodeBlocks: true,
|
||||
@ -88,11 +75,25 @@ const bundle = () => {
|
||||
publicURL: '/',
|
||||
})
|
||||
.bundle()
|
||||
.then(() =>
|
||||
.then(() => {
|
||||
const smStream = new SitemapStream({ hostname: 'https://awesome-docker.netlify.com/' });
|
||||
smStream.write({
|
||||
url: '/',
|
||||
changefreq: 'daily',
|
||||
priority: 0.8,
|
||||
lastmodrealtime: true,
|
||||
lastmodfile: 'dist/index.html',
|
||||
});
|
||||
|
||||
smStream.end();
|
||||
return streamToPromise(smStream);
|
||||
})
|
||||
.then(sm =>
|
||||
// Creates a sitemap object given the input configuration with URLs
|
||||
fs.outputFile(
|
||||
'dist/sitemap.xml',
|
||||
sm.createSitemap(sitemapOpts).toString(),
|
||||
// sm.createSitemap(sitemapOpts).toString(),
|
||||
sm.toString()
|
||||
),
|
||||
);
|
||||
};
|
||||
|
@ -35,4 +35,4 @@
|
||||
"eslint-plugin-prettier": "3.1.2",
|
||||
"prettier": "1.19.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user