返回文章列表文章索引阅读全文
STARBLOG / 阅读手记
杂七杂八

My New Blog Is Live, Plus a Record of Wrestling with Hexo

Since Jianshu and Zhihu often delete my blog posts for various reasons, and my previous WordPress blog has already broken, I've been wanting to set up a new blog. That's when I took a liking to Hexo static blogs—hosting them directly on GitHub is both convenient and free. The official docs already cover configuration in plenty of detail, so I won't repeat that here. Blog URL: http://blog.deali.cn/ Besides all the configuration, I also spent a day writing scripts to import my old blog, download images, do replacements, and so on. Plenty of problems came up along the way—it felt annoying and like a waste of time,

曦远 (DealiAxy)约 9 分钟
目录7 个章节

Since Jianshu and Zhihu often delete my blog posts for various reasons, and my previous WordPress blog has already broken, I've been wanting to set up a new blog. That's when I took a liking to Hexo static blogs—hosting them directly on GitHub is both convenient and free.

The official docs already cover configuration in plenty of detail, so I won't repeat that here.

Blog URL: http://blog.deali.cn/

Besides all the configuration, I also spent a day writing scripts to import my old blog, download images, do replacements, and so on. Plenty of problems came up along the way—it felt annoying and like a waste of time. But once I'd started, not seeing it through would have made all the previous work feel wasted, so as of today it's finally up and running~

I've written an article before about extracting images from Markdown. This time I upgraded it so it can download all remote images in Markdown and replace them with local relative paths. I'll write a separate post about it when I have time.

Reference: https://zhuanlan.zhihu.com/p/87811246

Screenshots First

Here's the final result—not bad, right?

Home

Categories

Choosing a Theme

Hexo official docs: https://hexo.io/zh-cn/docs/

The theme I chose is hexo-theme-indigo. Homepage: https://github.com/yscoder/hexo-theme-indigo

Use Grunt, a common Node.js automated build tool, to generate permalinks based on file hash values.

You need to install Grunt first and configure it a bit. Just check the official docs for that: https://gruntjs.com/getting-started

Reference: http://blog.jvaeyhcd.wang/posts/05c9df7e0c47bd64.html

Travis CI Continuous Integration

To auto-deploy the blog, you ideally need two GitHub repositories: one named whatever you like, and one named github用户名.github.io, so it can be accessed directly.

Here's the config:

First, the .travis.yml file

# 语言
language: node_js
# node版本
node_js:
  - 8
# 指定缓存模块
cache:
  directories:
    - node_modules
# 监听分支
branches:
  only:
    - master
install:
  - npm install
script:
  - hexo clean
  - hexo generate
after_script:
  - git config user.name "用户名"
  - git config user.email "邮箱"
  - sed -i "s/{GH_TOKEN}/${GH_TOKEN}/g" ./_config.yml
  - hexo deploy

Then, at the end of the _config.yaml file, the deploy section:

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  - type: git
    repository: https://{GH_TOKEN}@这里放上第二个github仓库的链接
    branch: master

The rest of the steps are pretty simple. Refer to these two docs: (By the way, the official docs seem to have it wrong—go by mine instead)

Welcome to Discuss

I've put together a series of technical articles and materials. Reply with linux, flutter, c#, netcore, android, java, python, etc. in the WeChat official account 「程序设计实验室」 to get the related technical articles and materials.

_EOF_

My New Blog Is Live, Plus a Record of Wrestling with Hexo

本文作者:
程序设计实验室
版权声明:
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

相关文章

youtube-dl下载太慢了,我选yt-dlp

前言 最近过年嘛,过年前照例来下载一些贺岁歌曲,现在国内没啥人做贺岁专辑,这方面还得看马来西亚华人,他们每年都有出专辑,质量很不错! 国内平台自然是没有(或者不全的),需要在YouTube下载~ 之前我都是用Chrome插件下载完再使用脚本合并视频,有点繁琐,今年试试自动下载的黑科技~ 作为对比的这俩工具,都用 pip 安装即可 pip install youtube-dl pip install

2023-01-24 · 杂七杂八 · 约 1 分钟

苹果竟然给我发这种邮件?这是什么新骗局

今天突然收到一封邮件,说是我的Apple ID被锁了,要我点击链接登录解锁,一开始我是觉得挺烦的,上个月我的美区ID刚被锁了,折腾了很久联系了台湾的客服才给解锁的,现在我国区的ID也被锁了?苹果怕是药丸。 不过看这封邮件总觉得有什么不对劲的地方…… 你这apple单词的e好像不是英文字母吧,如果苹果公司发来的邮件会是这个?而且这发件的邮箱也不对啊,没见过这域名,苹果的难道不是apple.com吗?

2021-12-18 · 杂七杂八 · 约 1 分钟

讨论

共 0 条

良言一句三冬暖,恶语伤人六月寒。

加载评论中…