[Hexo] Use hexo-generator-feed plugin to generate Atom 1.0 or RSS 2.0 feed automatically in Hexo

hexo-generator-feed

Hexo is a fast, simple & powerful blog framework. It use plugins to provide features powerful APIs for limitless extensibility. Various plugins are available to support most template engines (EJS, Pug, Nunjucks, and many others). Easily integrate with existing NPM packages (Babel, PostCSS, Less/Sass, etc).

hexo-generator-feed plugin will generate Atom 1.0 or RSS 2.0 feed files for Hexo pages, posts, categories, tags.

Installation

Use npm to install hexo-generator-feed package.

1
2
3
$ npm install hexo-generator-feed --save

$ hexo clean

Configuration

In the front-matter of your post, you can optionally add a description, intro or excerpt setting to write a summary for the post. Otherwise the summary will default to the excerpt or the first 140 characters of the post.

1
2
3
4
5
6
7
---
title: lorem ipsum
date: 2020-01-02
description:
intro:
excerpt:
---

You can configure this plugin in _config.yml.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# _config.yml

feed:
enable: true
type: atom
path: atom.xml
limit: 20
hub:
content:
content_limit: 140
content_limit_delim: ' '
order_by: -date
icon: icon.png
autodiscovery: true
template:

Visit Options - https://github.com/hexojs/hexo-generator-feed#options to learn more options.

Finally, you can visit <Your Site Url>/atom.xml in the browser, and check whether the atom.xml works correctly after Hexo restarted or regenerated.

References

[1] GitHub - hexojs/hexo-generator-feed: Feed generator for Hexo. - https://github.com/hexojs/hexo-generator-feed

[3] Hexo - https://hexo.io/