Welcome to Hexo

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quickstart

Create a new post

1
hexo new "My New Post"

More info: Writing

Run server

1
hexo server

More info: Server

Generate static files

1
hexo generate

More info: Generating

Deploy to remote sites

1
hexo deploy

More info: Deployment

next

主要记录一下 next 主题的一些简单的配置,以便后面更加轻松的使用 next 的一些配置。

下载主题

1
2
cd hexo
git clone https://github.com/theme-next/hexo-theme-next themes/next

主题说明

在项目文件中有多个_config.yml 文件,为方便区分。

  • hexo 根目录下的_config.yml 称为站点配置文件

  • next 主题文件夹下的 theme/next/_config.yml 称为主题配置文件

设置语言

主题配置文件中设置简体中文

1
language: zh-CN

设置 Menu

新建页面

1
hexo new page categories

为文章指定分类

1
2
3
4
title: Next主题配置
date: 2019-12-15 10:57:12
categories:
- hexo

更新主题

1
2
cd themes/next
git pull

参考

next 官方文档

markdown 嵌入 ipynb

登陆 nbviewer ,然后输入相应的 ipynb 文件链接,即可在线显示。也可以在本地的 jupyter 中打开。

1
<iframe src="https://nbviewer.jupyter.org/github/royalosyin/Python-Practical-Application-on-Climate-Variability-Studies/blob/master/ex12-Analysis%20of%20Monthly%20GPCP%20precipitation.ipynb" width="570" height="2000"></iframe>

Github CI/CD

配置 私有仓库存储 hexo 笔记,公有仓库存储生成的 静态页面.

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
39
40
41
42
43
44
45
46
47
# .github/workflows/deploy.yml
# Deploy to pages
name: Pages
on:
workflow_dispatch:
push:
branches:
- master

jobs:
pages:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18

- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
# 使用 developer settings 生成的 personal token 部署
# 参考 https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token
personal_token: ${{ secrets.PERSONAL_TOKEN }}
external_repository: msclock/msclock.github.io
publish_branch: master
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'