11ty / eleventy-plugin-rss

A pack of Eleventy plugins for generating an RSS feed.
https://www.11ty.dev/docs/plugins/rss/
MIT License
92 stars 22 forks source link

Add option to use new Virtual Templates feature to avoid creating feed template files manually. #47

Closed zachleat closed 3 weeks ago

zachleat commented 1 month ago

The docs right now require both addPlugin and creation of a file on your file system to populate your feed. We can simplify this to one step with virtual templates: https://github.com/11ty/eleventy/issues/1612

https://www.11ty.dev/docs/plugins/rss/#sample-feed-templates

Related: #38 and https://github.com/11ty/eleventy/issues/3294

zachleat commented 3 weeks ago

Usage example for RSS Plugin v2.0:


import { feedPlugin } from "@11ty/eleventy-plugin-rss";

export default function(eleventyConfig) {
    eleventyConfig.addPlugin(feedPlugin, {
        type: "atom", // "json" or "rss" also supported.
        outputPath: "/feed/feed.xml",
        collection: {
            name: "posts",
            limit: 10,
        },
        metadata: {
            language: "en",
            title: "Blog Title",
            subtitle: "This is a longer description about your blog.",
            base: "https://example.com/",
            author: {
                name: "Your Name",
                email: "me@example.com"
            }
        }
    });
};
zachleat commented 3 weeks ago

Finalizing this one, it’ll be ready with Eleventy core v3.0.0-alpha.13. Ironed out one last bug today with absolute URL transformation.

zachleat commented 3 weeks ago

Docs are live on https://www.11ty.dev/docs/plugins/rss/#virtual-template