0%

博客发布笔记

1. 介绍

本文主要写博客配置。

2. Mac 配置

1
2
3
4
5
npm install hexo-cli -g
cd LichBlog
npm install
npm i hexo-generator-json-content --save
hexo server

3.博客发布过程

1
hexo new "<文章标题>"

编辑文件。然后上传到 github

连接到 AWS

1
2
3
4
5
sshblog # ssh connect to blog
git checkout -- package.json
npm i
git pull # /blog and /blog/theme/yilia
hexo g

4. Option 内容

4.1 yilia theme 进行了更新

yilia theme 有新的 commit 可以 merge 到自己的 fork 下面。然后 push 到 Master 分支。

1
2
git pull https://github.com/litten/hexo-theme-yilia
git push

如果有 conflict 看Addressing merge conflicts

4.2 AWS 上的 .gitignore 文件

1
2
3
4
5
db.json
package.json
__pycache__/
package-lock.json
.gitignore

每日固定时间发布博客代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
# @Author: lich
# @Date: 2017-08-13 17:21:11
# @Email: [email protected]
# @Last Modified by: Lich_Amnesia
# @Last Modified time: 2017-08-17 15:29:26
# schedule a job to be run in a process pool on 24 hours intervals.

from datetime import datetime
import os

from apscheduler.schedulers.blocking import BlockingScheduler

from pytz import timezone
# Use America/Denver time as default time.
mountain_time = timezone("America/Denver")


def pull_job():
print('The time is: %s' % datetime.now())
os.system("git checkout -- db.json")
os.system("git checkout -- package.json")
os.system("npm i")
os.system("git pull")
os.system("hexo g")
print('The time is: %s' % datetime.now())

if __name__ == '__main__':
scheduler = BlockingScheduler()
scheduler.add_executor('processpool')
scheduler.add_job(pull_job, 'cron',
day_of_week='mon-sun', hour=21, minute=30, timezone=mountain_time)
print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))

try:
scheduler.start()
except (KeyboardInterrupt, SystemExit):
pass

因为我们是朋友,所以你可以使用我的文字,但请注明出处:http://alwa.info