We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d2df64 commit e8969bcCopy full SHA for e8969bc
site/scripts/patch-sitemap.sh
@@ -1,4 +1,19 @@
1
#!/usr/bin/env bash
2
3
+# Remove the sitemap index file (we only have one sitemap)
4
rm dist/sitemap-index.xml
5
mv dist/sitemap-0.xml dist/sitemap.xml
6
+
7
+# Add lastmod dates to sitemap entries
8
+# Use current date as lastmod for all entries since we don't track per-page dates
9
+CURRENT_DATE=$(date -u +"%Y-%m-%d")
10
11
+# Use sed to add <lastmod> after each <loc> tag
12
+# This works on both macOS and Linux
13
+if [[ "$OSTYPE" == "darwin"* ]]; then
14
+ # macOS
15
+ sed -i '' "s|</loc>|</loc><lastmod>${CURRENT_DATE}</lastmod>|g" dist/sitemap.xml
16
+else
17
+ # Linux
18
+ sed -i "s|</loc>|</loc><lastmod>${CURRENT_DATE}</lastmod>|g" dist/sitemap.xml
19
+fi
0 commit comments