Installations
npm install hexo-feed
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
12.22.12
NPM Version
6.14.16
Statistics
14 Stars
36 Commits
4 Forks
2 Watching
1 Branches
3 Contributors
Updated on 31 Oct 2024
Languages
JavaScript (69.35%)
EJS (30.65%)
Total Downloads
Cumulative downloads
Total Downloads
111,330
Last day
-10.1%
248
Compared to previous day
Last week
-1.4%
1,597
Compared to previous week
Last month
24.7%
7,007
Compared to previous month
Last year
280.8%
68,192
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
hexo-feed
hexo-feed
is a plugin for Hexo static site generator that builds RSS, Atom and JSON Feed for your content.
- Supports most popular formats: RSS, Atom and JSON Feed.
- Lightweight and fast.
- Customizable. You can choose which formats to use, how many posts should be included in the feed, ordering and more.
- Generates feeds by tags and categories. It is possible to generate feed not only for the whole website content but also for every tag/category.
- Support for custom templates. If you are unhappy with the default template for some of the format, you can specify your own template and build there exactly what you want.
How it works
- The plugin registers a few generators that run once you build your website.
- Every generator analyzes your website content (posts, tags, categories) and prepares the data.
- Based on the content the plugin generates the feed with default (or custom) template.
- Once the website is published user can grab the feed.
Requirements
- Hexo: 4.x
- Node 12+
Usage
- Install the plugin using npm:
1$ npm install hexo-feed --save-dev
- Once the plugin is installed it is enabled by default. So you can build your website with Hexo and see the result. By default, the following feed files will be created:
rss.xml
,atom.xml
, andfeed.json
. - Add custom configuration to the Hexo config file if you want to customize the plugin behavior.
- Publish your website and enjoy your feed 🎉.
Configuration
To configure the plugin add feed
key to the Hexo config file. For example:
1feed: 2 limit: 20 3 order_by: "-date" 4 tag_dir: "tag" 5 category_dir: "category" 6 rss: 7 enable: true 8 template: "themes/theme/layout/_alternate/rss.ejs" 9 output: "rss.xml" 10 atom: 11 enable: true 12 template: "themes/theme/layout/_alternate/atom.ejs" 13 output: "atom.xml" 14 jsonFeed: 15 enable: true 16 template: "themes/theme/layout/_alternate/json.ejs" 17 output: "feed.json"
Key | Required | Default value | Description |
---|---|---|---|
limit | false | 0 | Post count that will be presented in the feed. Use 0 to publish all posts to the feed. |
order_by | false | -date | Sorting order for the posts. |
tag_dir | false | tag | Directory name to publish all tag-related feeds. Set false to avoid generating feeds by tag. For more information see below. |
category_dir | false | category | Directory name to publish all category-related feeds. Set false to avoid generating feeds by category. For more information see below. |
rss.enable | false | true | Enable/disable RSS feed generating. |
rss.template | false | Path to custom template for the RSS feed. | |
rss.output | false | rss.xml | Output filename for RSS feed. |
atom.enable | false | true | Enable/disable ATOM feed generating. |
atom.template | false | Path to custom template for the ATOM feed. | |
atom.output | false | atom.xml | Output filename for ATOM feed. |
jsonFeed.enable | false | true | Enable/disable JSON feed generating. |
jsonFeed.template | false | Path to custom template for the JSON feed. | |
jsonFeed.output | false | feed.json | Output filename for JSON feed. |
Adding link to your feed into the website layout
It's strongly recommended to include links to your feeds into the head section of your website pages. So, once you installed the plugin add the following code into your layout.ejs
file:
1<html> 2 <head> 3 4 <!-- ... --> 5 6 <link rel="alternate" type="application/rss+xml" title="<%= config.title %>" href="<%= full_url_for(`/rss.xml}`) %>" /> 7 <link rel="alternate" type="application/atom+xml" title="<%= config.title %>" href="<%= full_url_for(`/atom.xml`) %>" /> 8 <link rel="alternate" type="application/json" title="<%= config.title %>" href="<%= full_url_for(`/feed.json`) %>" /> 9 </head> 10 <body> 11 12 <!-- ... --> 13 14 </body> 15</html>
The plugin intentionally doesn't change the <head>
section content. It allows you to customize the tag in the way you want.
Tags/categories support
hexo-feed
supports generating separated feeds for every tag and category. It allows your users to subscribe to a particular tag or category instead of all posts on the website.
Generating feeds for tags and categories is enabled by default. If you want to disable it set tag_dir
and category_dir
parameter to false
.
Important notice.
hexo-generator-tag
andhexo-generator-category
packages should be installed in order to generate tag/category feeds.
Template customization
If you want to customize the feed template, specify the template path in rss.template
, atom.template
or jsonFeed.template
parameter. You can use default templates from hexo-feed
as a reference:
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/sergeyzwezdin/hexo-feed/publish.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/sergeyzwezdin/hexo-feed/publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/sergeyzwezdin/hexo-feed/publish.yml/master?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/28 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/publish.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Score
3.7
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More