Skip to content

[User Story] Blog categories too restrictive; no RSS feed for subscribers #24

Description

@coderabbitai

Summary

1. Categories type hardcoded to only two values

src/lib/types.ts:

export type Categories = 'sveltekit' | 'svelte';

Any blog post with a different category (e.g., 'life', 'tech', 'anime') will cause a TypeScript error.

Fix: Broaden the type to accommodate real content:

export type Categories = 'sveltekit' | 'svelte' | 'tech' | 'life' | 'anime' | (string & {});

2. No RSS/Atom feed

There is no feed endpoint, making the blog undiscoverable to RSS readers.

Fix: After extracting getPosts() to src/lib/server/posts.ts (see Architecture issue), add src/routes/rss.xml/+server.ts:

import { getPosts } from '$lib/server/posts';
export async function GET() {
  const posts = await getPosts();
  const xml = `<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel>
  <title>lora-sys Blog</title>
  <link>https://your-domain.com/blog</link>
  ${posts.map(p => `<item>
    <title>${p.title}</title>
    <link>https://your-domain.com/blog/${p.slug}</link>
    <pubDate>${new Date(p.date).toUTCString()}</pubDate>
    <description>${p.description}</description>
  </item>`).join('')}
</channel></rss>`;
  return new Response(xml, { headers: { 'Content-Type': 'application/xml' } });
}

Backlink: #1 | Requested by: @lora-sys

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions