-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Description
Description
When using gatsby-plugin-sitemap to generate sitemap.xml, <lastmod> was not available by default.
Manually adding this would output <lastmod> tags in the final sitemap.xml, but the date were written as NaN-NaN-NaN
Note: Even if we manually uses lastmod: '2020-08-03T01:54:49.000Z' during the serialize below still outputs as NaN
Steps to reproduce
{
resolve: `gatsby-plugin-sitemap`,
options: {
createLinkInHead: true,
query: `{
site {
siteMetadata {
siteUrl
}
}
allSitePage {
nodes {
path
context {
updated
}
}
}
}`,
resolveSiteUrl: ({ site }) => {
return site.siteMetadata.siteUrl;
},
serialize: ({ site, allSitePage }) =>
allSitePage.nodes.map((node) => {
return {
url: `${site.siteMetadata.siteUrl}${node.path}`,
changefreq: `daily`,
priority: 0.7,
lastmod: `${node.context.updated}`,
};
}),
},
},
Expected result
Expecting the sitemap to output entries with correct last-modified tags, ie:<lastmod>2020-08-03T01:54:49.000Z</lastmod>
Actual result
<lastmod>NaN-NaN-NaN</lastmod>
Environment
System:
OS: macOS 10.15.6
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.17.0 - ~/.nvm/versions/node/v12.17.0/bin/node
npm: 6.14.7 - ~/.nvm/versions/node/v12.17.0/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 84.0.4147.105
Safari: 13.1.2
npmPackages:
gatsby: ^2.24.4 => 2.24.4
gatsby-image: ^2.4.13 => 2.4.13
gatsby-plugin-catch-links: ^2.3.11 => 2.3.11
gatsby-plugin-feed-mdx: ^1.0.1 => 1.0.1
gatsby-plugin-google-analytics: ^2.3.11 => 2.3.11
gatsby-plugin-manifest: ^2.4.18 => 2.4.21
gatsby-plugin-mdx: ^1.2.27 => 1.2.27
gatsby-plugin-offline: ^3.2.18 => 3.2.18
gatsby-plugin-preact: ^4.0.9 => 4.0.9
gatsby-plugin-react-helmet: ^3.3.10 => 3.3.10
gatsby-plugin-robots-txt: ^1.5.1 => 1.5.1
gatsby-plugin-s3: ^0.3.3 => 0.3.4
gatsby-plugin-sharp: ^2.6.19 => 2.6.22
gatsby-plugin-sitemap: ^2.4.11 => 2.4.11
gatsby-plugin-styled-components: ^3.3.10 => 3.3.10
gatsby-remark-attr: ^0.1.0 => 0.1.0
gatsby-remark-external-links: 0.0.4 => 0.0.4
gatsby-remark-images: ^3.3.19 => 3.3.19
gatsby-remark-unwrap-images: ^1.0.2 => 1.0.2
gatsby-source-filesystem: ^2.3.20 => 2.3.23
gatsby-transformer-sharp: ^2.5.11 => 2.5.11
npmGlobalPackages:
gatsby-cli: 2.12.66