套娃建站指南

hexo

命令

  • $ hexo generate/hexo g ## 生成静态文件
  • $ hexo new “post title with whitespace” 新建文章
  • $ hexo server/hexo s ## 在服务器上运行 --debug参数 调试模式
  • $ hexo clean ## 清除生成的文件

Pure

其他

  • emoji大全 https://gist.github.com/rxaviers/7360908
  • _config.yml根目录下站点配置文件 主题目录下 主题配置文件
  • Latex公式支持
    • mathjax: true
    • \text{}
  • emoji支持
  • mermaid支持
    • 编辑博客根目录下的blog/_config.yml,在最后添加如下内容:
1
2
3
4
5
mermaid: ## mermaid url https://github.com/knsv/mermaid
enable: true
version: "8.8.0"
options: # find more api options from https://github.com/knsv/mermaid/blob/master/src/mermaidAPI.js
#startOnload: true // default true

mermaid

  • 尝试markdown-it-mermaid插件失败
  • hexo-filter-mermaid-diagrams成功 https://github.com/webappdevelp/hexo-filter-mermaid-diagrams
    • 注意版本问题,默认的7.1.2和8.0.0都解析失败和不全,最后换了最新的8.8.0成功。可以在 https://mermaid-js.github.io/mermaid/#/?id=cdn 查看最新的CDN版本。
    • Pure主题的配置用的是ejs文件,所以最后选择在\layout\_partial\article.ejs中添加成功。
    • 不成功可以在index.html中依次check<pre class="mermaid"></pre><script src="https://unpkg.com/mermaid@8.8.0/dist/mermaid.min.js"></script>

gitalk

  • 在授权gitalk后出现403错误(gitalk Error: Request failed with status code 403)

    1
    2
    3
    4
    5
    git clone https://github.com/Rob--W/cors-anywhere.git
    cd cors-anywhere/
    npm install
    heroku create
    git push heroku master
    1
    proxy: 'https://blooming-shore-57168.herokuapp.com/https://github.com/login/oauth/access_token',
  • github提示clientSecret泄露问题,问题不大。

    • 获取或修改 GitHub 用户数据,需要 token,为了拿到 token,除了需要 OAuth App 的 client_id 和 client_secret 外,还需要一个 Authorization Code。
    • 这个 code 是 GitHub 登录授权完成时,在跳转回 redirect_uri 的查询参数拿到的, edirect_uri 必须是在 OAuth App 配置的 callback URL 域名下。
    • 这样即使别人用了你的 client_id 和 lient_secret ,跳转之后也拿不到 code,所以,有 client_id 和 client_secret 也做不了什么。

相册

图片放在source文件中,因为需要编译成静态文件,非常慢。