Skip to content

Commit bfe0999

Browse files
committed
chore(site): patch rel="icon"
1 parent 0ec59b6 commit bfe0999

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"private": true,
1818
"scripts": {
1919
"astro": "astro",
20-
"build": "astro check && astro build && scripts/patch-sitemap.sh",
20+
"build": "astro check && astro build && scripts/patch.sh",
2121
"dev": "astro dev",
2222
"preview": "astro preview",
2323
"start": "astro dev"

site/scripts/patch-sitemap.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

site/scripts/patch.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
function patch_sitemap() {
4+
# Remove the sitemap index file (we only have one sitemap)
5+
rm dist/sitemap-index.xml
6+
mv dist/sitemap-0.xml dist/sitemap.xml
7+
8+
# Add lastmod dates to sitemap entries
9+
# Use current date as lastmod for all entries since we don't track per-page dates
10+
CURRENT_DATE=$(date -u +"%Y-%m-%d")
11+
12+
# Use sed with temp file (works on both macOS and Linux)
13+
sed "s|</loc>|</loc><lastmod>${CURRENT_DATE}</lastmod>|g" dist/sitemap.xml > dist/sitemap.xml.tmp
14+
mv dist/sitemap.xml.tmp dist/sitemap.xml
15+
}
16+
17+
function patch_link_rel_icon() {
18+
# find rel="shortcut icon" and replace with rel="icon" in every html file in dist
19+
find dist -name "*.html" | while read -r file; do
20+
sed "s|rel=\"shortcut icon\"|rel=\"icon\"|g" "$file" > "$file.tmp"
21+
mv "$file.tmp" "$file"
22+
done
23+
}
24+
25+
patch_sitemap
26+
patch_link_rel_icon

0 commit comments

Comments
 (0)