博客发布流程

  1. 新增 categories 分类页面

    • 新建页面

      1
      $ hexo new page k8s
    • 配置

      打开 blog/source/k8s/index.md,默认是下列内容:

      1
      2
      3
      4
      ---
      title: 分类
      date: 2018-10-22 14:25:08
      ---

      修改为:

      1
      2
      3
      4
      5
      6
      ---
      title: 分类
      date: 2018-10-22 14:25:08
      type: "categories"
      comments: false
      ---
    • 新建文章

      1
      $ hexo new "k8s集群搭建"

      打开 blog/source/_posts/k8s集群搭建.md, 默认头部信息如下:

      1
      2
      3
      4
      5
      ---
      title: k8s集群搭建
      date: 2018-10-22 23:03:42
      tags:
      ---

      修改为

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      ---
      title: k8s集群搭建
      comments: true
      date: 2018-10-22 23:03:42
      updated: 2019-10-22 23:03:42
      desc: 云服务器k8s集群搭建
      categories:
      - k8s
      tags: [k8s]
      keywords: k8s, cloudnative
      ---
      ## k8s 集群搭建
      具体的文章内容..........
    • 重启服务

      1
      2
      3
      4
      5
      6
      # 如果修改了 _config.theme.yml 注意执行 npm run build
      $ npm run build
      $ npm run server

      # 如果未修改过,执行下面命令
      $ hexo g && hexo s

友链

​ 友链与主题分离,数据存放在数据文件夹links.yml
​ 例子:

1
2
3
4
5
6
7
8
9
10
# links
马以:
link: https://www.ant.top
avatar: https://www.ant.top/images/avatar.jpg
desc: 马以

Ant:
link: https://www.ant.top
avatar: https://www.ant.top/images/avatar.jpg
desc: Ant

本地搜索

需要安装hexo-generator-json-content

1
$ npm i -S hexo-generator-json-content

主题配置

  • menu

    是否显示左侧 header 中的菜单,如果不需要可以注释掉。

  • menu_icons

    enable左侧菜单是否显示图标,如不需要可以设置成false
    其他配置项的值为iconfontclass。一般不需要更改,如果你需要新增图标可以提 Issue 或者更改图标可以更改主题的src/css/iconfont.css。图标来自阿里的 iconfont.cn

  • site

    favicon

    站点 favicon,相对source或主题根目录下的source
    例如/images.fvicon.ico相当于在source/images/favicon.ico中找。

    site_verfication

    Google 或 Baidu 提供的 HTML meta 验证。形如

    1
    <meta name="google-site-verification" content="your verification string">

    将 content 里的内容粘贴到对应的属性中。

    google_analytics

    在 Google Analytics 找到跟踪 ID(一般是以 UA- 开头)填入。留空不启用。

  • pagination

    prev, next 是否总是显示,默认为 true。仅当多于一页时有效。

  • comment

    type

    选择启用哪一种评论系统。留空则不启用。
    你可以通过front-mattercomment: boolean控制具体一篇 post 是否开启评论。默认开启。

  • github

    username

    GitHub username

  • postCount

    enable

    是否启用。需要安装相关的插件

    1
    $ npm i --save hexo-wordcount

    wordocunt

    是否显示文章字数统计

    min2read

    是否显示阅读时长预计

  • toc

    TOC 全局开关
    你可以通过front-mattertoc: boolean控制是否具体一篇 post 是否开启 toc。默认开启。

  • fancybox

    是否开启基于LightGallery图片 FancyBox 效果。默认开启。

  • license

    Copyright 显示的 HTML 片段。注释掉则不显示Copyright

  • footer

    custom

    自定义 Footer 的 HTML 片段。注释掉则不显示。

    具体例子可参考 Demo
    Demo 源文件 Source

  • profile

    enable

    是否显示 profile
    效果可以参考 Demo
    Demo 源文件 Source

    social

    • links

      Footer 显示的社交联系图标和链接。如需要添加图标可以提 Issue

  • links

    About 页面侧栏显示的链接

  • labels

    About 页面侧栏显示的 Labels

  • skills

    About 页面侧栏显示的 Skills

  • works

    About 页面侧栏显示的个人项目

  • widgets

    侧栏显示的 widget, 注释则关闭。

  • show_count

    侧栏的 tag, archive,category widget 中是否显示文章数量

  • cdn

    用到的 CDN 地址,如果你不知道是什么就不要改动。