Use Cases (अपडेट: 2/6/2026)

Claude Code से RSS Feed बनाना: Static Site के लिए RSS 2.0 और Atom Guide

Claude Code से RSS 2.0/Atom feed बनाएं: XML escaping, dates, absolute URLs, multilingual feeds, validation और cache.

Claude Code से RSS Feed बनाना: Static Site के लिए RSS 2.0 और Atom Guide

RSS अभी भी उपयोगी distribution channel है

Article publish करना और reader तक article पहुंचना अलग बातें हैं। Search, social media, newsletter, Slack और RSS reader अलग-अलग entry points हैं। RSS feed एक XML file होती है जिसमें article title, link, description, publish date और category होती है। XML strict format है, इसलिए बिना escape किया हुआ & भी feed तोड़ सकता है।

Atom भी feed format है और RFC 4287 में define किया गया है। ज्यादातर static sites के लिए पहले RSS 2.0 बनाना practical है। Atom तब जोड़ें जब कोई reader या integration मांगता हो। इस guide में Claude Code से feed बनाते समय XML escaping, date format, absolute URL, multilingual feed, validation, cache और review prompt को साथ में रखेंगे।

Primary sources जरूर देखें: RSS Advisory Board RSS 2.0 Specification, IETF RFC 4287, W3C Feed Validation Service और Astro RSS recipe. Related workflow के लिए Claude Code Blog CMS, SEO optimization और sitemap generation पढ़ें।

Real use cases

पहला use case developer blog के repeat readers हैं। Feedly, Inoreader या self-hosted reader इस्तेमाल करने वाले लोग कई technical sources पढ़ते हैं। RSS से आपका article उनकी reading queue में जाता है, social post पर निर्भर नहीं रहता।

दूसरा use case internal knowledge है। Release notes, incident reports, security notices और architecture decisions को same feed से Slack bot या internal portal में दिखाया जा सकता है। Human page और machine-readable XML दोनों same content source से बनते हैं।

तीसरा use case multilingual SEO है। अगर site में Hindi, English, Japanese और Spanish content है, तो एक mixed feed अच्छा नहीं है। /hi/rss.xml को Hindi collection, /hi/blog/ prefix और सही language use करना चाहिए।

चौथा use case monetization है। ClaudeCodeLab में articles templates, products, training और consultation तक ले जाते हैं। RSS repeat readers को वापस लाता है। Claude Code training और consultation CTA तभी natural लगता है जब article ने practical problem solve की हो।

Coding से पहले feed contract लिखें

Claude Code को काम देने से पहले rules define करें।

AreaRecommendationReason
Formatपहले RSS 2.0, Atom optionalSimple और widely supported
URLsAbsolute URLsExternal reader links खोल पाएगा
DatesRSS के लिए toUTCString(), Atom के लिए toISOString()Sorting bugs कम होते हैं
Bodyपहले descriptionFull HTML में sanitize चाहिए
Limit20 से 50 articlesFeed हल्का रहता है
CacheExplicit cache policyPublish के बाद stale feed कम होता है
ValidationLocal script और W3C ValidatorBrowser view काफी नहीं है

RSS 2.0 में channel site metadata रखता है और item article metadata। guid stable identifier है, आमतौर पर article permalink।

Dependency-free RSS generator

इसे scripts/generate-rss.mjs में रखें और node scripts/generate-rss.mjs चलाएं।

// scripts/generate-rss.mjs
import fs from "node:fs";
import path from "node:path";

const siteUrl = "https://example.com";
const outputPath = path.join(process.cwd(), "dist", "rss.xml");

const posts = [
  {
    title: "Claude Code से RSS Feed बनाना",
    description: "Static site के लिए RSS 2.0 feed generate और validate करें।",
    slug: "claude-code-rss-feed",
    pubDate: "2026-06-02T09:00:00+09:00",
    tags: ["Claude Code", "RSS"],
  },
];

function escapeXml(value) {
  return String(value ?? "")
    .replace(/&/g, "&")
    .replace(/</g, "&lt;")
    .replace(/>/g, "&gt;")
    .replace(/"/g, "&quot;")
    .replace(/'/g, "&apos;");
}

function toRssDate(value) {
  const date = new Date(value);
  if (Number.isNaN(date.getTime())) throw new Error(`Invalid date: ${value}`);
  return date.toUTCString();
}

const items = posts.map((post) => {
  const url = new URL(`/hi/blog/${post.slug}/`, siteUrl).toString();
  return `    <item>
      <title>${escapeXml(post.title)}</title>
      <link>${url}</link>
      <guid isPermaLink="true">${url}</guid>
      <description>${escapeXml(post.description)}</description>
      <pubDate>${toRssDate(post.pubDate)}</pubDate>
    </item>`;
}).join("\n");

const xml = `<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>ClaudeCodeLab Hindi</title>
    <link>${siteUrl}/hi/</link>
    <description>Claude Code practical guides</description>
    <language>hi</language>
    <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
    <ttl>60</ttl>
${items}
  </channel>
</rss>
`;

fs.mkdirSync(path.dirname(outputPath), { recursive: true });
fs.writeFileSync(outputPath, xml, "utf8");
console.log(`Generated ${outputPath}`);

Important guards हैं escapeXml(), new URL() और date validation। Claude Code refactor करे तब भी ये guards रहने चाहिए।

Astro implementation

Astro project में official @astrojs/rss package use करें।

npm install @astrojs/rss
// src/pages/hi/rss.xml.ts
import rss from "@astrojs/rss";
import { getCollection } from "astro:content";

export async function GET(context: { site: URL }) {
  const posts = await getCollection("blog-hi", ({ data }) => !data.draft);

  const items = posts
    .sort((a, b) => {
      const aDate = new Date(a.data.updatedDate ?? a.data.pubDate).getTime();
      const bDate = new Date(b.data.updatedDate ?? b.data.pubDate).getTime();
      return bDate - aDate;
    })
    .slice(0, 30)
    .map((post) => ({
      title: post.data.title,
      description: post.data.description,
      pubDate: post.data.updatedDate ?? post.data.pubDate,
      link: `/hi/blog/${post.id}/`,
      categories: post.data.tags,
    }));

  return rss({
    title: "ClaudeCodeLab Hindi",
    description: "Claude Code practical guides",
    site: context.site,
    items,
    customData: "<language>hi</language><ttl>60</ttl>",
  });
}

Layout के head में discovery links जोड़ें।

<link rel="alternate" type="application/rss+xml" title="ClaudeCodeLab RSS" href="/hi/rss.xml" />
<link rel="alternate" type="application/atom+xml" title="ClaudeCodeLab Atom" href="/hi/atom.xml" />

Atom, multilingual feeds और validation

Atom में stable id और ISO date रखें।

function atomEntry(post, siteUrl) {
  const url = new URL(`/hi/blog/${post.slug}/`, siteUrl).toString();
  return `  <entry>
    <title>${escapeXml(post.title)}</title>
    <link href="${url}" />
    <id>${url}</id>
    <updated>${new Date(post.pubDate).toISOString()}</updated>
    <summary>${escapeXml(post.description)}</summary>
  </entry>`;
}

Multilingual config में collection, prefix और language साथ रखें।

const feeds = [
  { collection: "blog", prefix: "", language: "ja", title: "ClaudeCodeLab" },
  { collection: "blog-en", prefix: "/en", language: "en", title: "ClaudeCodeLab English" },
  { collection: "blog-hi", prefix: "/hi", language: "hi", title: "ClaudeCodeLab Hindi" },
];

Local validation script:

// scripts/check-feed.mjs
const feedUrl = process.argv[2] ?? "http://localhost:4321/hi/rss.xml";
const response = await fetch(feedUrl);
const xml = await response.text();
const failures = [];

if (!response.ok) failures.push(`HTTP status is ${response.status}`);
if (!xml.includes("<rss")) failures.push("missing rss root");
if (!xml.includes("<channel>")) failures.push("missing channel");
if (!xml.includes("<item>")) failures.push("missing item");
if (/&(?!amp;|lt;|gt;|quot;|apos;|#\d+;|#x[a-fA-F0-9]+;)/.test(xml)) failures.push("unescaped ampersand");
if (!/<guid[^>]*>https?:\/\//.test(xml)) failures.push("guid should be absolute");

if (failures.length) {
  console.error(failures.map((failure) => `- ${failure}`).join("\n"));
  process.exit(1);
}

console.log(`OK: ${feedUrl}`);

Common failures: R&D बिना escape, draft feed में आना, relative URL, ambiguous date, Hindi feed से English page खुलना, CDN cache बहुत लंबा होना।

Claude Code prompt और hands-on check

इस Astro static site के लिए RSS 2.0 implement करें।
- सिर्फ src/pages/hi/rss.xml.ts edit करें।
- @astrojs/rss use करें।
- draft exclude करें।
- updatedDate या pubDate से newest first sort करें।
- 30 items limit रखें।
- /hi/blog/ prefix रखें।
- language और ttl जोड़ें।
- commands और validation result report करें।
RSS implementation को critically review करें।
XML escaping, relative URLs, draft leakage, date format, stable guid, multilingual prefix, cache और W3C validation risks पहले check करें।

मैंने इसे छोटे Astro-style data set पर test किया। Local script ने unescaped & और non-absolute guid पकड़ लिया। Human review में translation quality, CTA fit और real reader display देखना पड़ा। Team workflow में RSS, sitemap, article QA और conversion path जोड़ने के लिए Claude Code training और consultation practical next step है।

#Claude Code #RSS #Atom #Astro #static site
मुफ़्त

मुफ़्त PDF: Claude Code cheatsheet

Email डालें और commands, review habits तथा safe workflow वाली एक-page PDF पाएँ.

हम आपका data सुरक्षित रखते हैं और spam नहीं भेजते.

Masa

लेखक के बारे में

Masa

Claude Code workflow और team adoption पर काम करने वाला engineer.