Skip to content

Commit 1349c39

Browse files
committed
chore(site): try to fix sitemap and favicon
1 parent bfe0999 commit 1349c39

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed

.github/workflows/deploy-site.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
version: 10
2424
- uses: actions/setup-node@v4
2525
with:
26-
node-version: 20
26+
node-version: 24
2727
cache: "pnpm"
2828
- name: Install dependencies
2929
run: pnpm install

site/astro.config.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export default defineConfig({
173173
editLink: {
174174
baseUrl: 'https://github.com/JamieMason/syncpack/edit/main/site/',
175175
},
176-
favicon: '/favicon.ico',
176+
favicon: '/logo.svg',
177177
logo: {
178178
src: './src/assets/logo.svg',
179179
},
@@ -233,6 +233,13 @@ export default defineConfig({
233233
Head: './src/components/Head.astro',
234234
},
235235
head: [
236+
{
237+
tag: 'link',
238+
attrs: {
239+
rel: 'apple-touch-icon',
240+
href: '/syncpack/apple-touch-icon-180x180.png',
241+
},
242+
},
236243
{
237244
tag: 'script',
238245
attrs: {
8.41 KB
Loading

site/public/social-card.jpg

-54.3 KB
Binary file not shown.

site/scripts/patch.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import fs from 'node:fs/promises';
2+
3+
const sitemap = await fs.readFile('dist/sitemap.xml', 'utf8');
4+
5+
const urls = sitemap.match(/<loc>(.*?)<\/loc>/g).map(url => url.replace(/<loc>|<\/loc>/g, ''));
6+
7+
await fs.writeFile('dist/sitemap.txt', `${urls.join('\n')}\n`);

site/scripts/patch.sh

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,13 @@ function patch_sitemap() {
44
# Remove the sitemap index file (we only have one sitemap)
55
rm dist/sitemap-index.xml
66
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
7+
# create sitemap.txt
8+
node scripts/patch.js
9+
# replace sitemap.xml with sitemap.txt
1910
find dist -name "*.html" | while read -r file; do
20-
sed "s|rel=\"shortcut icon\"|rel=\"icon\"|g" "$file" > "$file.tmp"
11+
sed "s|sitemap.xml|sitemap.txt|g" "$file" > "$file.tmp"
2112
mv "$file.tmp" "$file"
2213
done
2314
}
2415

2516
patch_sitemap
26-
patch_link_rel_icon

0 commit comments

Comments
 (0)