npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexo-feed

v1.1.2

Published

RSS, Atom and JSON Feed generator for Hexo static site generator

Downloads

7,013

Readme

hexo-feed Publish on NPM

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

  1. The plugin registers a few generators that run once you build your website.
  2. Every generator analyzes your website content (posts, tags, categories) and prepares the data.
  3. Based on the content the plugin generates the feed with default (or custom) template.
  4. Once the website is published user can grab the feed.

Requirements

  • Hexo: 4.x
  • Node 12+

Usage

  1. Install the plugin using npm:
$ npm install hexo-feed --save-dev
  1. 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, and feed.json.
  2. Add custom configuration to the Hexo config file if you want to customize the plugin behavior.
  3. Publish your website and enjoy your feed 🎉.

Configuration

To configure the plugin add feed key to the Hexo config file. For example:

feed:
    limit: 20
    order_by: "-date"
    tag_dir: "tag"
    category_dir: "category"
    rss:
        enable: true
        template: "themes/theme/layout/_alternate/rss.ejs"
        output: "rss.xml"
    atom:
        enable: true
        template: "themes/theme/layout/_alternate/atom.ejs"
        output: "atom.xml"
    jsonFeed:
        enable: true
        template: "themes/theme/layout/_alternate/json.ejs"
        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:

<html>
  <head>

    <!-- ... -->

    <link rel="alternate" type="application/rss+xml" title="<%= config.title %>" href="<%= full_url_for(`/rss.xml}`) %>" />
    <link rel="alternate" type="application/atom+xml" title="<%= config.title %>" href="<%= full_url_for(`/atom.xml`) %>" />
    <link rel="alternate" type="application/json" title="<%= config.title %>" href="<%= full_url_for(`/feed.json`) %>" />
  </head>
  <body>

    <!-- ... -->

  </body>
</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 and hexo-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: