Skip to content

Commit

Permalink
Fix sitemap date
Browse files Browse the repository at this point in the history
Also:
- bump to node 22
- use `netlify-plugin-cache`
  • Loading branch information
j0k3r committed Feb 3, 2025
1 parent 6806319 commit 2b0badd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22
4 changes: 2 additions & 2 deletions _config/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export default function (eleventyConfig) {
return dayjs(dateObj).locale('fr').format('D MMMM YYYY');
});

eleventyConfig.addFilter('htmlDateString', (dateObj) => {
return dayjs(dateObj).format('YYYY-MM-D');
eleventyConfig.addFilter('sitemapDate', (dateObj) => {
return dayjs(dateObj).format('YYYY-MM-DD');
});

// Get the first `n` elements of a collection.
Expand Down
2 changes: 1 addition & 1 deletion content/sitemap.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ eleventyExcludeFromCollections: true
{% set absoluteUrl %}{{ page.url | htmlBaseUrl(metadata.url) }}{% endset %}
<url>
<loc>{{ absoluteUrl }}</loc>
<lastmod>{{ page.date | htmlDateString }}</lastmod>
<lastmod>{{ page.date | sitemapDate }}</lastmod>
</url>
{%- endfor %}
</urlset>
6 changes: 6 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[build]
publish = "_site"
command = "yarn build"

[[plugins]]
package = "netlify-plugin-cache"

[plugins.inputs]
paths = [ ".cache" ]
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@
"zod": "^3.23.8",
"zod-validation-error": "^3.3.1"
},
"dependencies": {}
"dependencies": {
"netlify-plugin-cache": "^1.0.3"
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,11 @@ ms@2.1.3, ms@^2.1.3:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==

netlify-plugin-cache@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/netlify-plugin-cache/-/netlify-plugin-cache-1.0.3.tgz#f60514e259dff2b3286b6d60b570bb1c81206794"
integrity sha512-CTOwNWrTOP59T6y6unxQNnp1WX702v2R/faR5peSH94ebrYfyY4zT5IsRcIiHKq57jXeyCrhy0GLuTN8ktzuQg==

node-retrieve-globals@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/node-retrieve-globals/-/node-retrieve-globals-6.0.0.tgz#682889351b83fb7b6c48d0e09b16a0487ff3ee1f"
Expand Down

0 comments on commit 2b0badd

Please sign in to comment.