theme config done

This commit is contained in:
d0zingcat
2019-11-20 19:32:07 +08:00
commit 97c846465f
12 changed files with 7426 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "themes/even"]
path = themes/even
url = https://github.com/D0zingcat/hexo-theme-even
branch = master

98
_config.yml Normal file
View File

@@ -0,0 +1,98 @@
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site
title: For(;;);
subtitle: d0zingcat's personal blog
description: this is d0zingcat's carbin.
keywords:
author: d0zingcat
language: en
timezone: ''
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://blog.d0zingcat.xyz
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing index.html from permalinks
# Directory
source_dir: source
public_dir: public
tag_dir: tags
#archive_dir: archives
#category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
enable: true # Open external links in new tab
field: site # Apply to the whole site
exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: true
line_number: true
auto_detect: false
tab_replace: ''
# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
path: ''
per_page: 10
order_by: -date
# Category & Tag
default_category: uncategorized
category_map:
tag_map:
# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true
# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## Use post's date for updated date unless set in front-matter
use_date_for_updated: false
# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page
# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
exclude:
ignore:
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: even
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: ''

4568
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

26
package.json Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"hexo": {
"version": "4.0.0"
},
"dependencies": {
"hexo": "^4.0.0",
"hexo-generator-archive": "^1.0.0",
"hexo-generator-category": "^1.0.0",
"hexo-generator-index": "^1.0.0",
"hexo-generator-tag": "^1.0.0",
"hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^2.0.0",
"hexo-renderer-scss": "^1.2.0",
"hexo-renderer-stylus": "^1.1.0",
"hexo-server": "^1.0.0"
}
}

4
scaffolds/draft.md Normal file
View File

@@ -0,0 +1,4 @@
---
title: {{ title }}
tags:
---

4
scaffolds/page.md Normal file
View File

@@ -0,0 +1,4 @@
---
title: {{ title }}
date: {{ date }}
---

5
scaffolds/post.md Normal file
View File

@@ -0,0 +1,5 @@
---
title: {{ title }}
date: {{ date }}
tags:
---

View File

@@ -0,0 +1,38 @@
---
title: Hello World
---
Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues).
## Quick Start
### Create a new post
``` bash
$ hexo new "My New Post"
```
More info: [Writing](https://hexo.io/docs/writing.html)
### Run server
``` bash
$ hexo server
```
More info: [Server](https://hexo.io/docs/server.html)
### Generate static files
``` bash
$ hexo generate
```
More info: [Generating](https://hexo.io/docs/generating.html)
### Deploy to remote sites
``` bash
$ hexo deploy
```
More info: [Deployment](https://hexo.io/docs/one-command-deployment.html)

View File

@@ -0,0 +1,20 @@
---
title: Migrating to hexo from hugo
date: 2019-11-20 16:54:40
tags: ["hexo", "hugo", "blog", "static"]
---
> 先辈们说:[Don't Reinvent The Wheel, Unless You Plan on Learning More About Wheels](https://blog.codinghorror.com/dont-reinvent-the-wheel-unless-you-plan-on-learning-more-about-wheels/),反正就是不要重复造轮子,因为这本身是一件浪费时间的事情。
最早的时候我是使用[Wordpress](https://wordpress.com)的那个时候是还是LAMP、LNMP满天飞的时代各种一键脚本层出不穷虽然我不一定会用但是事实证明我总是重复地去配置也没有整理成自动化的脚本最后对于我掌握这门技巧还是没有任何实质性的帮助。就这样用了很久很久博客也得到了比较好的发展也有不少的访问量了突然发现了[Github Pages](https://pages.github.com),而且借助[Cloudflare](https://www.cloudflare.com)也可以实现半程的HTTPS访问具体怎么做可以自行Google这边不作赘述。然后折腾了一段时间之后得到了最优解也使用过[Pelican Static Site Generator](https://blog.getpelican.com)[Hexo](https://hexo.io)+[NexT](https://theme-next.iissnan.com)。当然维护了一段时间之后发现场上除了经久不衰的Wordpress之外还出现了[Grav](https://getgrav.org)、[Ghost](https://ghost.org)、[Typecho](typecho.org)等优秀的CMS搅局者但是这些都没有吸引住我的目光直到[GoHugo](https://gohugo.io)。
<!--more-->
Gohugo是个非常高效的静态博客生成器而且是用我当时最痴迷的[Golang](https://golang.org)编写的切举例子说当博客数量在100+篇时Hexo的生成速度非常的缓慢但是Hugo几秒钟就生成好了当然随着版本的迭代我相信Hexo已经解决了这个问题。所以当时二话不说直接再次抛弃之前的博客尽管配置好了很多东西采用了[Hugo](https://gohugo.io)+[cocoa-eh-hugo-theme](https://github.com/mtn/cocoa-eh-hugo-theme)来生成我的个人博客然后托管在VPS上。而为了实现真·HTTPS我自己购买了SSL证书配置了Nginx+HSTS每次写完博客之后通过Rsync增量同步到VPS的nginx目录上面去同时为了实现清真的部署方式我的Nginx是容器部署的。具体怎么做的如果有人感兴趣可以留言让我介绍一下有这个需求的话我可以再写一篇唠唠嗑介绍一下这边略过。
直到最近我了解到了现在大家偏向于把自己的博客部署在[Netlify](https://www.netlify.com)或是[Zeit](https://zeit.co)上当然还有持续的生命力的Github Pages我猜测可能是前面两种支持无痛的CI吧当然之前也有人会使用[Travis CI](https://travis-ci.org)自动生成静态网页然后部署在Github Pages上因为我本来就不会选择部署在Github Pages上所以就直接忽略了。虽然现在Github已经开放了[GitHub Actions](https://github.com/features/actions)可能更加方便CI了吧但是我还没好好了解过所以就先不谈了。另外Netlify和Zeit都支持自动申请和续期[Let's Encrypt ](https://letsencrypt.org)的免费HTTPS证书甚至自己也不用使用[Acme.sh](http://acme.sh)去申请和管理自己的证书非常方便所以我决定尝试一下而且可以每个月省一笔VPS的开销何乐而不为虽然早晚会被割韭菜的但是到时候再说吧
因为之前的主题实在是不够美观(虽然真的非常简洁),所以我选择更换主题为[Even](https://github.com/olOwOlo/hugo-theme-even)但是碰到了个很大的问题是这个主题是从Hexo移植的最后一次更新还是在2018年算是很久没更新了。另外就是如果打开了TOC会导致浏览器的滚动条无限滚动我还[提了个issue](https://github.com/olOwOlo/hugo-theme-even/issues/209)。所以我就很没骨气地准备迁移回Hexo就为了用这个我比较喜欢地主题。嗯我真是个渣男+外貌协会。
所以这次结论就很明确了使用Hexo+Netlify+Even来部署我的个人博客接下来简单介绍一下步骤。
比较坑的是Netlify在拉取信息的时候如果主Repo中有repo的嵌套必须添加submodule但是submodule中不一定会追踪文件的更改。

1
themes/even Submodule

Submodule themes/even added at 78afd28ef6

2651
yarn.lock Normal file

File diff suppressed because it is too large Load Diff