Skip to content

Commit 0ffd294

Browse files
Merge pull request #124 from MaddyGuthridge/maddy-sitemap-fixes
Fix issue with missing namespace for sitemap
2 parents 3c87348 + 4b0e88a commit 0ffd294

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "minifolio",
3-
"version": "1.1.8",
3+
"version": "1.1.9",
44
"private": true,
55
"license": "GPL-3.0-only",
66
"scripts": {

src/lib/server/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const gitClient = async (baseDir: string | undefined) => {
5252
'-o',
5353
`UserKnownHostsFile=${knownHostsFile()}`,
5454
].join(' ');
55-
console.log('Debug: gunning git with SSH command:');
55+
console.log('Debug: running git with SSH command:');
5656
console.log(gitSshCommand);
5757
git = git.env('GIT_SSH_COMMAND', gitSshCommand);
5858
}

src/routes/sitemap.xml/+server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ export async function GET(req: Request) {
77

88
const baseUrl = `${req.url.protocol}//${req.url.host}`;
99

10-
const root = create({ version: '1.0', encoding: 'UTF-8' }).ele('urlset');
10+
const root = create({ version: '1.0', encoding: 'UTF-8' })
11+
.ele('urlset')
12+
.att('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
13+
1114
for await (const id of iterItems()) {
1215
root.ele('url').ele('loc').txt(`${baseUrl}${id}`);
1316
}

tests/backend/sitemap.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ beforeEach(async () => {
1919
it('Generates a basic sitemap for an empty site', async () => {
2020
await expect(api.sitemap()).resolves.toStrictEqual({
2121
urlset: {
22+
'@xmlns': 'http://www.sitemaps.org/schemas/sitemap/0.9',
2223
url: {
2324
loc: `${BASE_URL}/`
2425
}
@@ -30,6 +31,7 @@ it('Includes children in sitemap', async () => {
3031
await api.item(itemId.fromStr('/child')).info.post('Child item');
3132
await expect(api.sitemap()).resolves.toStrictEqual({
3233
urlset: {
34+
'@xmlns': 'http://www.sitemaps.org/schemas/sitemap/0.9',
3335
url: [
3436
{
3537
loc: `${BASE_URL}/`,

0 commit comments

Comments
 (0)