0%

Hexo-Next博客搭建历程

hexo图片问题

hexo博客图片问题
Hexo添加图片
PicGo + 国内的github - 码云来实现markdown图床
PicGo github

添加头像

next主题添加作者头像

开启使用MathJax

themes/next/_config.yml

1
2
3
4
5
6
7
math:
per_page: false # false:每页都渲染

mathjax:
enable: true
# See: https://mhchem.github.io/MathJax-mhchem/
mhchem: false

设置hexo首页只显示部分摘要(不显示全文)

设置hexo首页只显示部分摘要(不显示全文)

添加搜索功能

  • 首先进入根目录
  • 打开git bash输入以下命令
    npm install hexo-generator-searchdb --save
  • 然后进入hexo的配置文件(位置:根目录/_config.yml)
  • 添加以下代码
    1
    2
    3
    4
    5
    6
    7
    # Search Config
    search:
    path: search.json #之前就是这里出了问题导致图标错误,错误的教程是 search.xml
    field: post
    format: html
    limit: 1000

  • 进入主题的根目录(..\themes\next_config.yml)
  • 修改以下代码,把enable的false改为true
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    # Local Search
    # Dependencies: https://github.com/theme-next/hexo-generator-searchdb
    local_search:
    enable: true
    # If auto, trigger search by changing input.
    # If manual, trigger search by pressing enter key or search button.
    trigger: auto
    # Show top n results per article, show all results by setting to -1
    top_n_per_article: 1
    # Unescape html strings to the readable one.
    unescape: false
    # Preload the search data when the page loads.
    preload: false

  • 然后下边流程
    1
    2
    3
    hexo clean
    hexo g
    hexo d
    转载自

设置回到开头

将back2top的enable设置为true即可,边栏和滚动百分比可以按照需求自行添加。
..\themes\next_config.yml

1
2
3
4
5
6
7
back2top:
enable: true
# Back to top in sidebar.
sidebar: false
# Scroll percent label in b2t button.
scrollpercent: true

设置已读进度条

..\themes\next_config.yml

1
2
3
4
5
6
7
8
# Reading progress bar
reading_progress:
enable: true
# Available values: top | bottom
position: bottom
color: "#37c6c0"
height: 3px

参考

复制代码块

..\themes\next_config.yml

1
2
3
4
5
6
7
8
9
10
11
12
codeblock:
# Code Highlight theme
# Available values: normal | night | night eighties | night blue | night bright | solarized | solarized dark | galactic
# See: https://github.com/chriskempson/tomorrow-theme
highlight_theme: normal
# Add copy button on codeblock
copy_button:
enable: true
# Show text copy result.
show_result: true
# Available values: default | flat | mac
style:

引用B站视频

参考博客

玩转hexo参考笔记

https://blog.csdn.net/awt_fudonglai/category_10191857.html
https://www.cnblogs.com/guide2it/p/11111633.html

博客

https://hongcyu.cn/