feat: add RSS per-category feed template, discovery links, and WebSub notifications
- Create category-feed.njk (RSS 2.0 pagination template) - Add conditional <link rel="alternate"> tags for category pages in base.njk - Extend WebSub hub notifications to include per-category feed URLs
This commit is contained in:
@@ -908,6 +908,22 @@ export default function (eleventyConfig) {
|
||||
`${siteUrl}/feed.xml`,
|
||||
`${siteUrl}/feed.json`,
|
||||
];
|
||||
|
||||
// Discover category feed URLs from build output
|
||||
const outputDir = directories?.output || dir.output;
|
||||
const categoriesDir = resolve(outputDir, "categories");
|
||||
try {
|
||||
for (const entry of readdirSync(categoriesDir, { withFileTypes: true })) {
|
||||
if (entry.isDirectory() && existsSync(resolve(categoriesDir, entry.name, "feed.xml"))) {
|
||||
feedUrls.push(`${siteUrl}/categories/${entry.name}/feed.xml`);
|
||||
feedUrls.push(`${siteUrl}/categories/${entry.name}/feed.json`);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// categoriesDir may not exist on first build — ignore
|
||||
}
|
||||
|
||||
console.log(`[websub] Notifying hub for ${feedUrls.length} URLs...`);
|
||||
for (const feedUrl of feedUrls) {
|
||||
try {
|
||||
const res = await fetch(hubUrl, {
|
||||
|
||||
Reference in New Issue
Block a user