• Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

In Next 7.7, the CODE for the RSS button was removed and the XML file was generated in the same way as before, but without the button. This article describes adding an RSS method with buttons in Next 7.7.

Add the RSS

Install the hexo-Generator-feed plug-in

Run the command in the hexo directory:

npm install hexo-generator-feed --save
Copy the code

configurationSite profile

Add to the site profile:

Plugins: hexo-generate-feed # RSS feed: type: atom path: atom.xml limit: 20 hub: Content: content_limit: 140 content_limit_delim: ' ' order_by: -dateCopy the code

Configuration NextTopic profile

The topic configuration file does not have an RSS field by default, so you need to add it manually

# Set rss to false to disable feed link.
# Leave rss as blank to use site's feed link, and install hexo-generator-feed: `npm install hexo-generator-feed --save`.
# Set rss to specific value if you have burned your feed already.
rss: /atom.xml
Copy the code

test

Running hexo G at this point can already be seen

INFO  Generated: atom.xml
Copy the code

In fact, the configuration is successful

But there are no RSS buttons in the sidebar

Add an RSS button to the sidebar

In the Hexo/themes/next/layout/_partials/sidebar folder, open the site-overview.swig file

Add code before -if theme. Site_state:

         {% if theme.rss %}
            <div class="feed-link motion-element">
              <a href="{{ url_for(theme.rss) }}" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          {% endif %}
​
Copy the code

To see the effect, execute hexo G && hexo s