docs(sitemap): add credit and clarify comments

This commit is contained in:
curben 2019-08-19 10:19:36 +09:30
parent 6f4c9135c8
commit 0e57c98c10
No known key found for this signature in database
GPG Key ID: 5D9DB57A25D34EE3
1 changed files with 2 additions and 3 deletions

View File

@ -21,6 +21,7 @@ module.exports = function (locals) {
.sort((a, b) => { .sort((a, b) => {
return b.date - a.date return b.date - a.date
}) })
// https://github.com/pyyzcwg2833/hexo-generator-sitemap/commit/a92dbbb83cc39ff60d43faa5cd688a56574a3889
.map((post) => ({ .map((post) => ({
...post, ...post,
permalink: post.permalink.replace('index.html', ''), permalink: post.permalink.replace('index.html', ''),
@ -35,16 +36,14 @@ module.exports = function (locals) {
const xmlConfig = { const xmlConfig = {
config: config, config: config,
posts: posts, posts: posts,
// add the sNow variable for creation of the home page and potential tags/cats // add current time to <lastmod> of homepage and tags
sNow: moment().format('YYYY-MM-DD[T00:00:00.000Z]') sNow: moment().format('YYYY-MM-DD[T00:00:00.000Z]')
} }
// add tags array available in the template
if (config.sitemap.tags !== false) { if (config.sitemap.tags !== false) {
xmlConfig.tags = locals.tags.toArray() xmlConfig.tags = locals.tags.toArray()
} }
// add categories available in the template
if (config.sitemap.categories !== false) { if (config.sitemap.categories !== false) {
xmlConfig.categories = locals.categories.toArray() xmlConfig.categories = locals.categories.toArray()
} }