又又改了一下博客的架构

干啥啥不行,重构第一名。

What can I do? Refactor first.

惊觉一年多没写博客了,惭愧。最近大半年做了挺多东西,想写的主题也有很多。奈何「动物森友会」「塞尔达传说旷野之息」「怪物猎人GU」实在太好玩了!他们占据了我绝大多数业余时间,根本无暇顾及博客什么的,连摄影都耽搁了。

I suddenly realized that I hadn’t written a post for more than a year. During this time I’ve done a lot of things. However, ‘Animal Crossing,’ ‘The Legon Of Zelda,’ and ‘Monster Hunter GU’ are too attractive that I can’t stop playing them! They take up most of my spare time. They are leaving me with no time for blogging or photography.

之前博客是通过「hexo」生成的,主题是大名鼎鼎的「NexT」,图片部署在「imgur」 图床。本以为这套体系一步到位不需要再折腾了,但是依然有几个问题困扰我。一是「hexo」基于 nodejs,博客生成速度实在让人难以满意,并且npm的依赖过于繁琐,每隔几个月遇到的各种包冲突和版本问题让人困扰;二是墙越来越高,国内访问日渐缓慢,已经到了不开代理无法正常访问的程度了,趁着国庆前一天上班摸鱼的时候,把博客再好好整理一番吧。

My perverse blog is based on hexo, and the blog theme is NexT - The most used theme on GitHub. The blog images are hosted on Imgur. I thought this system would be a step in the right direction and not need to pay attention to, but there are still a few problems that bother me. One is hexo is written by nodejs. I am not satisfied with the generator speed, and dependency management of npm is too tedious. The other is GFW is getting higher and higher, and the domestic access is getting slower and slower, which has reached the point where it cannot normally access without a proxy. I took advantage of the day before National Day to take a look at my blog and reorganize it.

首先是生成器,目前 hexo 的问题就是太慢,想提高速度的话,自然想到我工作主力:go。让人开心的是,hugo就是一款用 go 编写的静态博客生成器,功能完善,主题也很丰富。通过各种 google,我找到一款很对胃口的主题:hyde,样式简洁,还能随意切换主题色,几个颜色都非常好看。

The biggest problem with hexo is generator speed. If I want to improve its speed, I naturally think of my primary programming language:golang. As luck would have it, Hugo was just the Static-Site-Generator written by golang, which with rich functions and all kinds of themes. And searching by google, I find a suitable theme named hyde; Witch has different styles and simple config.

剩下的就是图片问题了,国内的各路CDN服务商碍于规定,即使免费用户也需要域名备案登记。国外的CDN厂商也会遇到 imgur 一样的问题,所以参考网友的方法,新建一个 github page 仓库,把所有图片扔进去,通过一个单独的图片域名指到这个仓库,这样一个「伪」CDN就弄好了,以后如果找到了合适的CDN厂商,还能给这个域名套一层CDN,变身「真」CDN域名。

The last problem is about images. Domestic CDN company is always required to real name check-in due to the government. Internal CDN company also in the face of GFW. So I reference other bloggers that push all the images to GitHub as a new repository. Then make a new domain direct to this repository as a CDN domain. If I find a suitable free CDN in the future, I can set this domain as a real CDN domain.

翻新以后,几十个静态网页能在一秒以内生成,push到github以后,图片加载速度也很满意,不出意外的话可以使用很长时间了。不知道在我下次改博客架构之前能写几篇博文呢?(装死中)

After refactoring, dozens of static pages can be generated in less than a second. I was also satisfied with the loading speed of the images. It will last a long time without an accident. I wonder how many posts I can write before I change my blog structure next time?

Comments

comments powered by Disqus