feat(blog): add feed xlst options to render beautiful RSS and Atom feeds (#9252)

Co-authored-by: ozakione <29860391+OzakIOne@users.noreply.github.com>
Co-authored-by: sebastien <lorber.sebastien@gmail.com>
This commit is contained in:
Rohan Thakur 2024-08-02 22:20:48 +05:30 committed by GitHub
parent 08a893a2eb
commit 7be1feaa0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 3224 additions and 113 deletions

View file

@ -315,10 +315,26 @@ declare module '@docusaurus/plugin-content-blog' {
}) => string | undefined;
export type FeedType = 'rss' | 'atom' | 'json';
export type FeedXSLTOptions = {
/**
* RSS XSLT file path, relative to the blog content folder.
* If null, no XSLT file is used and the feed will be displayed as raw XML.
*/
rss: string | null;
/**
* Atom XSLT file path, relative to the blog content folder.
* If null, no XSLT file is used and the feed will be displayed as raw XML.
*/
atom: string | null;
};
/**
* Normalized feed options used within code.
*/
export type FeedOptions = {
/** Enable feeds xslt stylesheets */
xslt: FeedXSLTOptions;
/** If `null`, no feed is generated. */
type?: FeedType[] | null;
/** Title of generated feed. */
@ -507,6 +523,14 @@ declare module '@docusaurus/plugin-content-blog' {
onInlineAuthors: 'ignore' | 'log' | 'warn' | 'throw';
};
export type UserFeedXSLTOptions =
| boolean
| null
| {
rss?: string | boolean | null;
atom?: string | boolean | null;
};
/**
* Feed options, as provided by user config. `type` accepts `all` as shortcut
*/
@ -515,6 +539,8 @@ declare module '@docusaurus/plugin-content-blog' {
{
/** Type of feed to be generated. Use `null` to disable generation. */
type?: FeedOptions['type'] | 'all' | FeedType;
/** User-provided XSLT config for feeds, un-normalized */
xslt?: UserFeedXSLTOptions;
}
>;
/**