本文最新更新于: 月小水长的个人博客
前言
开此贴的原因
前几天博客崩了,重新搭建了这个博客站点。
特开此贴记录next主题优化过程中遇到的问题,希望对大家有所帮助。
一些说明
前期相关的Hexo安装、本地/远程部署教程可百度在此不再赘述。
基于hexo-next v5.1.4,向上兼容,向下兼容性不确定,特此声明。
我的博客本地根目录是D:\hexoblog
站点配置文件全路径是D:\hexoblog\_config.yml
next主题文件全路径是D:\hexoblog\themes\next\_config.yml
hexo常见操作
hexo new "postName"
#新建文章
hexo new page "pageName"
#新建页面
hexo clean
#清除部署緩存
hexo n == hexo new
#新建文章
hexo g == hexo generate
#生成静态页面至public目录
hexo s == hexo server
#开启预览访问端口(默认端口4000,可在浏览器输入localhost:4000
预览)
hexo d == hexo deploy
#将.deploy目录部署到GitHub
hexo g -d
#生成加部署
hexo g -s
#生成加预览
next主题优化
next风格选择
next有四种风格,在站点配置文件搜索字段Scheme Settings
可以看到,
# Scheme Settings
# ---------------------------------------------------------------
# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
scheme: Gemini
我这里用的是四种:Gemini
next菜单设置
比如可以看到我的主页有首页
、留言
、分类
、归档
、标签
等菜单,
在站点配置文件下搜索menu:
,可以看到
menu:
home: / || home
about: /about/ || user
message: /message/ || comment
tags: /tags/ || tags
categories: /categories/ || th
archives: /archives/ || archive
#schedule: /schedule/ || calendar
#sitemap: /sitemap.xml || sitemap
#commonweal: /404/ || heartbeat
home
就是首页
;message
就是留言
…一开始只有首页和归档,其余的需要我们手动创建,
在站点根目录下打开命令行,输入hexo new page "about"
并在主题配置文件menu:
字段处取消对about的注释
重新部署我们就可以看到主页有关于
这个菜单了,其他的类似,
修改D:\hexoblog\source\about\index.md
,就可以修改关于
界面了
about: /about/ || user
中的user
是指关于
菜单附件的图标用的是图标库里面名为user
的图标
常见错误
本地预览和同时发布到远程的浏览结果不一致
这是由缓存造成的,需要先hexo clean
,再hexo g -d
部署到远程
markdown高级语法
插入连续多行的代码块
按一个tab键,然后贴代码,保证每一行代码前都要额外的tab键,同时最前面空一行。
比如,我前面插入的连续行代码的实现效果:
设置文字大小和颜色和居中效果
hello,world!
hello,world!
hello,world!
hello,world!
hello,world!
<font color="#FF0000"> hello,world! </font>
<font size=5> hello,world! </font>
<font size=5 color="#FF0000">hello,world! </font>
<center>hello,world!</center>
插入表格
效果图:
左对齐标题 | 右对齐标题 | 居中对齐标题 |
---|---|---|
短文本 | 中等文本 | 稍微长一点的文本 |
稍微长一点的文本 | 短文本 | 中等文本 |
markdown代码如下:
| 左对齐标题 | 右对齐标题 | 居中对齐标题 |
| :------| ------: | :------: |
| 短文本 | 中等文本 | 稍微长一点的文本 |
| 稍微长一点的文本 | 短文本 | 中等文本 |