Radio

一个小小程序员

0%

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.

Quick Start

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

快捷键
1
2
Ctrl+B对选中字体加粗
$$+Enter 公式
Hexo
1
2
3
4
5
6
7
8
9
10
$ hexo new 新博客名字
#编译md文件为静态页面
$ hexo generate
#推送public文件夹到main,github收到main发生变化,会自动重启,需要等待一会
$ hexo deploy
#编辑+部署
$ hexo g -d

$ hexo new page "页面名称"

source源码维护,方便不同计算机维护博客

1
2
3
4
5
6
7
更新本地源码到source
git init
git checkout -b source
git add -A
git commit -m "init blog"
git remote add origin git@github.com:radio93/radio93.github.io.git
git push origin source
新环境博客维护
1
2
3
4
5
6
7
8
9
10
11
#从git上的source分支down下来的源码
$ cd 项目
#Hexo 3.0 把服务器独立成了个别模块,必须先安装 hexo-server 才能使用
$ npm install hexo-server --save
#编译博客源码为静态页面
$ hexo generate
#尝试启动博客 默认端口4000
$ hexo server
#如果端口冲突 可以修改端口
$ hexo server -p 5000

常见问题
如果radio93.github.io无法访问,需要修改此处,博客主页在main下的index.html

项目名称需要和github名称保持一致

如果Gitalk控制台总是报错,可以查看下\themes\next\layout_third-party\comments\gitalk.swig中的链接是否最新,因为原域名已被更新

gitalk.swig源码如下:

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
{%- if page.comments %}
{%- set gitalk_css_uri = theme.vendors.gitalk_css or 'https://unpkg.com/gitalk/dist/gitalk.css' %}
<link rel="stylesheet" href="{{ gitalk_css_uri }}">

{%- set gitalk_js_uri = theme.vendors.gitalk_js or 'https://unpkg.com/gitalk/dist/gitalk.min.js' %}

<script>
NexT.utils.loadComments(document.querySelector('#gitalk-container'), () => {
NexT.utils.getScript('{{ gitalk_js_uri }}', () => {
var gitalk = new Gitalk({
clientID : '{{ theme.gitalk.client_id }}',
clientSecret: '{{ theme.gitalk.client_secret }}',
repo : '{{ theme.gitalk.repo }}',
owner : '{{ theme.gitalk.github_id }}',
admin : ['{{ theme.gitalk.admin_user }}'],
id : '{{ gitalk_md5(page.path) }}',
{%- if theme.gitalk.language == '' %}
language: window.navigator.language || window.navigator.userLanguage,
{% else %}
language: '{{ theme.gitalk.language }}',
{%- endif %}
distractionFreeMode: {{ theme.gitalk.distraction_free_mode }}
});
gitalk.render('gitalk-container');
}, window.Gitalk);
});
</script>
{%- endif %}