-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder.js
More file actions
26 lines (20 loc) · 731 Bytes
/
builder.js
File metadata and controls
26 lines (20 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pkg from 'react-router-sitemap';
const { sitemapBuilder } = pkg;
// import { routeDetails } from './index.js';
import path from 'path'; // add path which will be needed for file write
import fs from 'fs'; // import file system object
const paths = [
"/setup-py-generator",
"/"
];
// use your website root address here. Optimally you can
// include dev and production environments with variables
const hostname = 'https://pythoncreate.com';
const dest = path.resolve('./build', 'sitemap.xml');
const sitemap = sitemapBuilder(
hostname,
paths
);
// write sitemap.xml file in /public folder
// Access the sitemap content by converting it with .toString() method
fs.writeFileSync(dest, sitemap.toString())