• 简体中文
  • RSS 订阅

    ModernDuang 主题在页面头部内置了 RSS 链接,方便读者通过 RSS 阅读器订阅你的博客更新。

    前提条件

    在配置 RSS 之前,请确保 Hexo 主配置 _config.yml 中的 url 已设置为你的博客域名:

    # URL
    url: https://yourblog.com

    重要: url 必须填写真实的博客域名,否则 RSS 订阅链接中的地址将不正确。

    安装插件

    RSS 订阅依赖 hexo-generator-feed 插件,通过 npm 安装:

    npm install hexo-generator-feed --save

    配置

    在 Hexo 主配置文件 _config.yml末尾添加以下内容:

    # RSS Feed
    feed:
      type: atom
      path: atom.xml
      limit: 20
      hub:
      content: true
      content_limit: 140
      content_limit_delim: ' '
      order_by: -date
      icon: /img/avatar.png
      autodiscovery: true
      template:
    属性描述
    type订阅类型,可选 atom(推荐)或 rss2
    path订阅文件路径,默认 atom.xml
    limit最多包含的文章数量
    content是否在订阅中包含文章全文
    content_limit文章内容的最大字符数(content: true 时生效)
    order_by文章排序方式,-date 表示按日期倒序
    iconRSS 图标/头像路径
    autodiscovery是否在页面头部插入 RSS 自动发现链接

    启用后的效果

    • 访问 https://yourblog.com/atom.xml 即可获取 RSS 订阅源
    • 主题会自动在页面 <head> 中插入 RSS 链接,浏览器和 RSS 阅读器可自动发现
    • 页脚中可配置 RSS 社交图标(参见 社交图标