Star

linkRSS

You can add RSS to your blog by providing a simple configuration in .codedoc/config.ts:

.codedoc/config.ts
1linkimport { configuration } from '@codedoc/core';

2linkimport { codingBlog } from '@codedoc/coding-blog-plugin'; // --> import the plugin

3link

4link// ...

5link

6linkexport const config = /*#__PURE__*/configuration({

7link // ...

8link plugins: [

9link // ...

10link codingBlog({ // --> plug the plugin in

11link // ...

12link feed: {

13link url: 'https://<your>.coding.blog', // --> the base URL for your RSS feed

14link }

15link })

16link ],

17link // ...

18link});


The base-url is dependent on your hosting provider. In case of coding.blog, it will simply be the root URL of your blog. If you are hosting your blog on somewhere else and your blog is not hosted on the root of the domain (e.g. it is https://some.where/my-blog/ instead of https://some.where), then set it to the address of the root domain, not your blog URL.

Once configured, the plugin will generate the associated files, _feed.atom, _feed.json and _feed.rss, in the same folder where the rest of your HTML files will be generated to. These files will be generated upon each build, using git logs to determine when a file was created, when was it last updated, who is the author, etc.


RSS files are generated in 3 formats:


Based on your preferences, you can provide the link for any of these resources in your blogs. The following example shows how you can add a nice RSS link to your footer:

.codedoc/content/footer.tsx
1linkimport { CodedocConfig } from '@codedoc/core';

2linkimport { Footer as _Footer, Icon } from '@codedoc/core/components';

3link

4link

5linkexport function Footer(config: CodedocConfig, renderer: any) {

6link return <_Footer>

7link ...

8link <a href="https://<your>.coding.blog/_feed.rss" target="_blank">

9link <Icon>rss_feed</Icon> RSS

10link </a>

11link </_Footer>;

12link}


linkExcluding Files

By default, index.md and 404.md will be excluded from the feed. You can expand this list by writing markdown file addresses (relative to CODEDOC search base) in the plugin's config:

.codedoc/config.ts
1linkimport { configuration } from '@codedoc/core';

2linkimport { codingBlog } from '@codedoc/coding-blog-plugin'; // --> import the plugin

3link

4link// ...

5link

6linkexport const config = /*#__PURE__*/configuration({

7link // ...

8link plugins: [

9link // ...

10link codingBlog({ // --> plug the plugin in

11link // ...

12link feed: {

13link url: 'https://<your>.coding.blog', // --> the base URL for your RSS feed

14link exclude: ['this.md', 'path/to/that.md'], // --> exclude these files from the feed

15link }

16link })

17link ],

18link // ...

19link});


Hero image by Matt Botsford from Unsplash


RSSProviding RSS LinksExcluding Files

Home Hero Images Titles Author Info Article Cards Tags RSS Miscellaneous Assets