mirror of
https://github.com/Linux4Yourself/book.git
synced 2025-01-23 22:42:26 +08:00
fix sitemap
This commit is contained in:
parent
481ac067f2
commit
2c80a78cf1
690
docs/sitemap.xml
690
docs/sitemap.xml
File diff suppressed because it is too large
Load Diff
@ -53,26 +53,22 @@ Date.prototype.toW3CString = function () {
|
|||||||
offsetSign + offsetHours + ':' + offsetMinutes;
|
offsetSign + offsetHours + ':' + offsetMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataItems = [];
|
let dataItems = [];
|
||||||
|
|
||||||
dataItems.push(`
|
dataItems.push(`<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">`);
|
||||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
||||||
`);
|
|
||||||
|
|
||||||
require('fs').readFileSync('docs/_sidebar.md', 'utf-8').split(/\r?\n/).forEach(function (line) {
|
require('fs').readFileSync('docs/_sidebar.md', 'utf-8').split(/\r?\n/).forEach(function (line) {
|
||||||
const data = line.split(']')[1];
|
const data = line.split(']')[1];
|
||||||
if (data) {
|
if (data) {
|
||||||
const result = data.replace('(', '').replace(')', '');
|
const result = data.replace('(', '').replace(')', '');
|
||||||
const url = `${urlBase}${result}`;
|
const url = `${urlBase}${result}`;
|
||||||
const urlItem = `
|
const urlItem = `<url>
|
||||||
<url>
|
|
||||||
<loc>${url}</loc>
|
<loc>${url}</loc>
|
||||||
<lastmod>${new Date().toW3CString()}</lastmod>
|
<lastmod>${new Date().toW3CString()}</lastmod>
|
||||||
<changefreq>monthly</changefreq>
|
<changefreq>monthly</changefreq>
|
||||||
<priority>0.25</priority>
|
<priority>0.25</priority>
|
||||||
</url>
|
</url>`;
|
||||||
`;
|
|
||||||
console.log(urlItem);
|
console.log(urlItem);
|
||||||
dataItems.push(urlItem);
|
dataItems.push(urlItem);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user