Skip to content

Commit 98a063a

Browse files
fix(blog): make RSS feed discoverable site-wide (#262)
* fix(blog): make RSS feed discoverable site-wide The RSS autodiscovery <link> only lived on the blog index and post pages, so a feed reader pointed at the root domain (postguard.eu) or any other marketing page found no feed. Move the autodiscovery link into the marketing layout head so every public page advertises the feed, and drop the now-redundant per-page duplicate on /blog/. Refs encryption4all/postguard-business#58 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * test(blog): add RSS autodiscovery regression test, dedupe post-page link Replace the leftover SvelteKit skeleton test (asserted h1 === "Welcome to SvelteKit", which never matched this site) with a regression test for the site-wide RSS autodiscovery link: it asserts the <link rel="alternate" type="application/rss+xml"> is present exactly once on /, /about/, /blog/, and a blog post page. Also remove the now-redundant per-page RSS <svelte:head> block from the blog post page — the marketing layout now provides the link site-wide, so the per-page copy produced a duplicate on post pages. Gitignore/prettierignore the Playwright artifact directories so the test run leaves the tree clean. Refs encryption4all/postguard-business#58 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: dobby-yivi-agent[bot] <275734547+dobby-yivi-agent[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 06afaa5 commit 98a063a

7 files changed

Lines changed: 51 additions & 25 deletions

File tree

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ package
77
.vscode
88
.env.local
99
.env.*.local
10-
*.pem
10+
11+
# Playwright
12+
/test-results
13+
/playwright-report
14+
/blob-report
15+
/playwright/.cache
16+
17+
*.pem
1118
*.pub
1219
*.sec
1320

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ build/
77
.svelte-kit/
88
dist/
99
node_modules/
10+
test-results/
11+
playwright-report/
1012

1113
# Lockfiles
1214
package-lock.json

src/routes/(marketing)/+layout.svelte

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
})
2020
</script>
2121

22+
<svelte:head>
23+
<!-- Site-wide RSS autodiscovery so feed readers pointed at any marketing
24+
page (including the root domain) find the blog feed. -->
25+
<link
26+
rel="alternate"
27+
type="application/rss+xml"
28+
title="PostGuard Blog RSS Feed"
29+
href="/blog/rss.xml"
30+
/>
31+
</svelte:head>
32+
2233
{#if !$isLoading}
2334
<a class="sr-only sr-only-focusable skip-link" href="#main-content">
2435
{$_('common.skipToMain', { default: 'Skip to main content' })}

src/routes/(marketing)/blog/+page.svelte

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,6 @@
5454
jsonLd={blogJsonLd}
5555
/>
5656

57-
<svelte:head>
58-
<link
59-
rel="alternate"
60-
type="application/rss+xml"
61-
title="PostGuard Blog RSS Feed"
62-
href="/blog/rss.xml"
63-
/>
64-
</svelte:head>
65-
6657
<div class="blog-index">
6758
<div class="header">
6859
<h1>Blog</h1>

src/routes/(marketing)/blog/[slug]/+page.svelte

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@
6464
jsonLd={articleJsonLd}
6565
/>
6666

67-
<svelte:head>
68-
<link
69-
rel="alternate"
70-
type="application/rss+xml"
71-
title="PostGuard Blog RSS Feed"
72-
href="/blog/rss.xml"
73-
/>
74-
</svelte:head>
75-
7667
<article class="blog-post">
7768
<header>
7869
<div class="meta">

tests/rss-autodiscovery.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { expect, test } from '@playwright/test'
2+
3+
const RSS_LINK =
4+
'head > link[rel="alternate"][type="application/rss+xml"][href="/blog/rss.xml"]'
5+
6+
// Regression test for the site-wide RSS autodiscovery link (issue
7+
// encryption4all/postguard-business#58). The autodiscovery <link> lives in the
8+
// marketing layout head, so every public page must advertise the blog feed
9+
// exactly once — including non-blog pages and blog pages, which must not carry
10+
// a leftover per-page duplicate.
11+
for (const path of ['/', '/about/', '/blog/']) {
12+
test(`RSS autodiscovery link is present exactly once on ${path}`, async ({
13+
page,
14+
}) => {
15+
await page.goto(path)
16+
await expect(page.locator(RSS_LINK)).toHaveCount(1)
17+
})
18+
}
19+
20+
test('RSS autodiscovery link is present exactly once on a blog post page', async ({
21+
page,
22+
}) => {
23+
await page.goto('/blog/')
24+
const firstPost = page.locator('a.post-card').first()
25+
const href = await firstPost.getAttribute('href')
26+
expect(href, 'expected at least one blog post link on /blog/').toBeTruthy()
27+
28+
await page.goto(href as string)
29+
await expect(page.locator(RSS_LINK)).toHaveCount(1)
30+
})

tests/test.ts

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

0 commit comments

Comments
 (0)