Skip to content

Commit 5febac2

Browse files
committed
chore(site): rename sitemap.xml
1 parent 8653f7c commit 5febac2

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

site/astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export default defineConfig({
145145
integrations: [
146146
starlight({
147147
title: 'Syncpack',
148+
routeMiddleware: './src/route-data.ts',
148149
social: [
149150
{
150151
icon: 'github',

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"private": true,
1515
"scripts": {
1616
"astro": "astro",
17-
"build": "astro check && astro build",
17+
"build": "astro check && astro build && scripts/patch-sitemap.sh",
1818
"dev": "astro dev",
1919
"preview": "astro preview",
2020
"start": "astro dev"

site/public/robots.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
User-agent: *
2+
Allow: /
3+
4+
Sitemap: https://jamiemason.github.io/syncpack/sitemap.xml

site/scripts/patch-sitemap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
rm dist/sitemap-index.xml
4+
mv dist/sitemap-0.xml dist/sitemap.xml

site/src/route-data.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineRouteMiddleware } from '@astrojs/starlight/route-data';
2+
3+
export const onRequest = defineRouteMiddleware(context => {
4+
context.locals.starlightRoute.head.some(item => {
5+
if (item.attrs?.rel === 'sitemap') {
6+
item.attrs.href = '/syncpack/sitemap.xml';
7+
return true;
8+
}
9+
});
10+
});

0 commit comments

Comments
 (0)