IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Hexo的一些增强--目录以及RSS订阅

    Ashes Born\'s Blog发表于 2021-12-13 07:07:14
    love 0
    • 阅读之前
      • 你需要知道的知识包括
      • 前置的一些环境
    • 使你的Hexo支持目录
    • 为你的博客生成RSS源
    • 尝试构建

    阅读之前#

    你需要知道的知识包括#

    • 使用npm/yarn管理项目的依赖
    • Hexo的基本使用

    前置的一些环境#

    • Node.js & NPM

    使你的Hexo支持目录#

    进入Hexo项目的根目录中,使用npm/yarn添加依赖

    1
    2
    3
    npm install hexo-toc #当你使用npm时
    # or
    yarn add hexo-toc #当你使用yarn时

    之后在根目录中的_config.yml添加:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    #目录
    toc:
    maxDepth: 3 #目录层级
    class: toc
    slugify: transliteration
    decodeEntities: false
    anchor:
    position: after
    symbol: '#'
    style: header-anchor #基础样式

    为你的博客生成RSS源#

    进入Hexo项目的根目录中,使用npm/yarn添加依赖

    1
    2
    3
    npm install hexo-generator-feed #当你使用npm时
    # or
    yarn add hexo-generator-feed #当你使用yarn时

    之后在根目录中的_config.yml添加:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    #目录
    toc:
    maxDepth: 3 #目录层级
    class: toc
    slugify: transliteration
    decodeEntities: false
    anchor:
    position: after
    symbol: '#'
    style: header-anchor #基础样式

    如果已经构建过项目,请先进入项目根目录下运行,清除缓存

    1
    hexo clean

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    # RSS support
    feed:
    enable: true
    type:
    rss2 # 与path关联
    path:
    rss2.xml # 与type关联
    limit: 140
    hub:
    content: true
    content_limit: 140
    content_limit_delim: ' '
    order_by: -date
    icon: https://avatars.githubusercontent.com/u/23006024?v=4 #RSS 展示的图标
    autodiscovery: true

    如果已经构建过项目,请先进入项目根目录下运行,清除缓存

    1
    hexo clean

    尝试构建#

    然后进行正常的hexo的生成和测试 ``` shell hexo g & hexo s



沪ICP备19023445号-2号
友情链接