This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
const path = require("path"); | |
const config = require("./package.json"); // Please add a "url" field to the package.json to serve as base domain | |
const ignoreFolders = ["_nuxt"]; // Modify if you see fit | |
const readFolder = "./dist"; // The location where static files are generated | |
const outputFile = "sitemap.xml" // The location to store the sitemap (placed at the root of the readFolder) | |
function flatten(lists) { | |
return lists.reduce((a, b) => a.concat(b), []); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Generates a sitemap based on the entries in exportPathMap in next.config.js file | |
Author: Joran Quinten | |
Don't forget to add the domain name as process variable PUBLIC_DOMAIN! | |
Trigger the file with a separate script in your package.json and add it to your build command in Netlify | |
(for instance, set Build command to: "npm run production && npm run postexport") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Dynamically hook (an array of) assets | |
**/ | |
var hookAssets = function(urls) { | |
var pattern = /(?:\.([^.]+))?$/; | |
if (typeof(urls) === 'string') urls = url.split(','); // force it to by an array | |
for (var i = 0; i < url.length; i++) { |