Next 主题配置

Hexo中next主题配置

1. next 主题安装

1
git clone https://github.com/theme-next/hexo-theme-next themes/next
  • 进入hexo目录,在Git bash中输入上面的命令,将next主题 安装在hexo/themes/下

2. 设置 hexo的主题为next主题

  • 修改hexo目录下的_config.yml文件,找到theme关键词,将其值修改为next

3. 配置next主题

  • 打开/hexo/themes/next/目录下的_config.yml
    • 设置scheme选项
1
2
3
4
5
6
7
8
9
# ---------------------------------------------------------------
# Scheme Settings
# ---------------------------------------------------------------

# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
scheme: Gemini
  • 设置第三方服务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Third Party Services Settings
# See: https://theme-next.org/docs/third-party-services/
# You may need to install dependencies or set CDN URLs in `vendors`
# There are two different CDN providers by default:
# - jsDelivr (cdn.jsdelivr.net), works everywhere even in China
# - CDNJS (cdnjs.cloudflare.com), provided by cloudflare
...
# hexo-rendering-pandoc (or hexo-renderer-kramed) needed to full MathJax support.
mathjax:
cdn: //cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML
#cdn: //cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML
...
# hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugineeded to full Katex support.
katex:
cdn: //cdn.jsdelivr.net/npm/katex@0/dist/katex.min.css
#cdn: //cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css
  • 设置分享按钮
    • 进入/hexo/themes/next/目录,输入下面的命令,安装sharebutton插件
1
git clone https://github.com/theme-next/theme-next-needmoreshare2 source/lib/needsharebutton
  - 在/hexo/themes/next/目录下的_config.yml文件中 设置needmoreshare2各项值为true
1
2
3
4
5
6
needmoreshare2:
enable: true
postbottom:
enable: true
float:
enable: true
  - 进入/hexo/themes/next/source/lib/needsharebutton/
1
git pull

4. 跳过文件渲染

  • skip_render使用了minimatch,开始匹配的位置是基于/hexo/source/目录的

    • 单个文件夹下全部文件:skip_render: test/*
    • 单个文件夹下指定类型文件:skip_render: test/*.html
    • 单个文件夹下全部文件以及子目录:skip_render: test/**
    • 多个文件夹以及各种复杂情况:
      1
      2
      3
      skip_render:
      - `test1/*.html`
      - `test2/**`
  • 输入单个数据时,冒号后面有空格;输入多个选项时须进行缩进

博客首页只显示文章摘要和阅读全文

在博客主页面的文章列表中,博客内容全部显示出来而不是只显示文章一部分和 阅读全文 按钮,这样显得首页的列表很杂乱和冗长,其实要解决这个问题很简单,只需要在我们编写markdown内容的时候,在适当的位置加入如下标签即可:

1
<!--more-->