这篇文章主要是用来记录下maupassant主题的优化与配置过程

1. hexo初级使用

创建新的博文(post)

1
$ hexo new "My New Post"

创建新的页面(page)

1
$ hexo new page "about"

清除缓存

1
$ hexo

生成hexo博客

1
$ hexo generate

启动服务预览

1
$ hexo server
1
$ hexo server -p 5000 #更改端口
1
$ hexo server -i 192.168.1.1 #自定义 IP

关闭预览为Ctrl+C

部署

1
$ hexo deploy

监视文件变动

1
$ hexo generate --watch #监视文件变动

2. hexo中级配置

2.1 友情链接

待写作

2.2 添加评论功能作为留言页面

待写作

2.3 菜单栏图标更换

待写作

2.4 本地搜索同时搜索所有内容

在Hexo根目录的_config.yml文件中修改类型为all

1
2
3
search:
path: search.xml
field: all
2.5 文章按照名字或者日期进行排序

待写作

2.6 文章自定义排序

待写作

2.7 建站时间

待写作

2.8 侧边栏

待写作

2.x 更多主题详细配置

https://www.haomwei.com/technology/maupassant-hexo.html

https://github.com/tufu9441/maupassant-hexo

3. hexo高级配置

3.1 hexo多终端写作
  1. 将hexo博客程序放入dropbox同步文件夹

    1533955219646

  2. 将所有PC上的生成SSH key,并将之添加至Github

    1533955368148

  3. Enjoy!

3.2 hexo设置网站icon图标
  1. 若要设置网站Favicon,可以将favicon.ico放在Hexo根目录的source文件夹下,建议的大小:32px*32px。

    1533955548644

  2. 若要为网站添加苹果设备图标,请将命名为apple-touch-icon.png的图片放在同样的位置,建议的大小:114px*114px。

  3. Enjoy!

3.3 自动添加目录
  1. 在文章的front-matter中添加toc: true即可让该篇文章显示目录。

  2. 如果需要新建文档默认显示,则直接在scaffolds目录下post的front-matter中添加toc: true
    1533955915936

  3. 效果图
    1533955962982
3.4 文章加密访问功能

待写作

3.5 添加Gitment作为自己的说说/只言片语

待写作

3.6 固定page页面作为首页
  1. 卸载hexo-generator-index插件
  2. 并在source文件夹下新建index.md作为首页内容
3.7 对文章根据分类生成索引并添加菜单栏
  1. 添加hexo-generator-index2插件

  2. hexo根目录下的_config.yml中添加以下内容,即可将所有分类名称为web的文章的索引生成后放置在public文件夹下的web文件夹中

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    index2_generator:
    - layout: 'archive' # use existing archive layout
    path: 'web' # output to web folder: http://127.0.0.1:4000/web/
    per_page: 10
    order_by: -date
    include:
    - category Web # include article which category is Web
    exclude:
    - tag Hexo # exclude article which tag is Hexo
    - layout: 'index' # use existing index layout
    path: '' # output to root directory: http://127.0.0.1:4000/
    index: true # Set whether index, results is_home() is true or not
  3. 在主题的菜单中添加即可

  4. 可以直接删除hexo根目录下的_config.yml中原先index-generator的内容,或者将之生成后放在一个目录内。再根据需要选择是否添加至菜单。

    1
    2
    3
    4
    index_generator:
    path: 'allpost'
    per_page: 10
    order_by: -name
  5. 更多详细配置

https://github.com/Jamling/hexo-generator-index2

3.8 在文章中添加本地视频

待写作

3.9 在文章中添加本地音乐

待写作

3.10

待写作

3.11 多图轮播功能

待写作

3.12 添加本地pdf,并生成在线预览

待写作

3.13 博客加入百度统计和google analysis

待写作

3.14 Typora进行markdown写作的图片处理方案

待写作

3.15 source文件夹下_post文件中Markdown文件的

待写作