Rayal's site

nothing to write

2年前为了梯子的掩护需求,匆匆在git page利用hexo搭建了个blog。一直以来也从来没写过东西,就留着一个hello world做摆设。最近一不小心翻了出来,决心重整一下,结果遇到一系列的问题。有些是升级中的新问题(eg: hexo 4.x -> 6.3),有的总感觉曾经研究过,但是忘了以后又得一点点扣文档,甚是浪费时间。特开此篇,把一些常见问题及solution & ref都记录一下。

Hexo设置

插件安装

hexo-theme-next

  • hexo-word-counter
  • hexo-renderer-pandoc
  • hexo-generator-searchdb

hexo-deployer-git

hexo-optimize

其他问题

  • 问题:如何使hexo文章在_post文件夹下的路径不映射到permenant-link中?
    • 利用titlename的变量区分,参考hexo-变量定义
      例如:
      1
      2
      new_post_name: :year/:title.md # 按年整理文档
      permalink: :name/ # 保持简洁的url
  • 问题:what does code_dir for? And how to use it?
    • 答:用于引用代码文件,除展示外还可供下载,例如有一个example_code.py文件:

      1
      2
      > ls source/downloads/code/
      example_code.py
      可以被引用为:
      1
      {% include_code code_name lang:python example_code.py %}
      效果如下:
      code_nameview raw
      1
      2
      3
      4
      # encoding: utf-8
      # example_code.py
      if __name__ == '__main__':
      print('Hello World!')
    • 参考: issue #3211

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

0%