-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.xml
299 lines (299 loc) · 90.8 KB
/
search.xml
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title><![CDATA[Hexo之常用操作]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-operating%2F</url>
<content type="text"><![CDATA[常用操作创建文章命令: 1$ hexo new [layout] <title> 参数说明: [layout]可以为以下三种: 参数名 功能 文章路径 post 新建博文 source/_posts page 新建页面(如404,分类) source draft 草稿 source/_drafts 草稿可通过一下命令发布: 1$ hexo publish [layout] <title> title注意: 不是博文标题, 是博文markdown文件的名字, 也是博文链接的后缀(如https://www.simon96.online/2018/10/12/hexo-tutorial/中的hexo-tutorial) 文章模版 创建模版 在新建文章时,Hexo 会根据 scaffolds 文件夹内相对应的文件来建立文件,例如: $ hexo new blog “simon” 在执行这行指令时,Hexo 会尝试在 scaffolds 文件夹中寻找 blog.md,并根据其内容建立文章。 修改参数 以下是您可以在模版中使用的变量: 变量 描述 layout 布局 title 标题 date 文件建立日期 Front-matter就是博文最上方以 --- 分隔的那部分。 默认可以使用的Front-matter: 参数 描述 默认值 layout 布局 title 标题 date 建立日期 文件建立日期 updated 更新日期 文件更新日期 comments 开启文章的评论功能 true tags 标签(不适用于分页) categories 分类(不适用于分页) permalink 覆盖文章网址 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之错误分析]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-error%2F</url>
<content type="text"><![CDATA[错误分析如果你使用Hexo遇到同样的问题,这里有一些常见问题的解决方案。 YAML Parsing Error12JS-YAML: incomplete explicit mapping pair; a key node is missed at line 18, column 29: last_updated: Last updated: %s 参数中包含冒号,请用加引号,如Last updated: %s 12JS-YAML: bad indentation of a mapping entry at line 18, column 31: last_updated:"Last updated: %s" 字段后面的冒号必须为英文冒号,如:last_updated: 字段冒号后面必须跟一个空格,如:last_updated: “Last updated: %s” EMFILE Error1Error: EMFILE, too many open files 生成大量的文件时,可能遇到EMFILE错误。 可以运行以下命令来增加允许同步I / O操作的数量。 1$ ulimit -n 10000 Process Out of Memory当hexo g时,遇到以下错误: 1FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory 如下,更改hexo-cli文件的第一行,来增大nodejs堆内存.该bug已在新版本修复。 1#!/usr/bin/env node --max_old_space_size=8192 Git Deployment Problems RPC failed 123error: RPC failed; result=22, HTTP code = 403fatal: 'username.github.io' does not appear to be a git repository 确保你有你的电脑上设置git正确或尝试使用HTTPS存储库URL。 Error: ENOENT: no such file or directory 这个需要有一定的git的知识,因为可能是由于写错了标签,类别,或文件名,导致本地和github冲突了,Git不能自动合并这一变化所以它打破了自动分支。 解决办法: 检查文章的标签和类别,确保本地和github上是相同的。 合并分支(Commit)。 清除,重构。在站点目录下,命令行(即Git Bash)运行hexo clean和hexo g 手动将站点目录下的public文件夹复制到您的桌面 从你的master分支切换到部署在本地分支。 从桌面复制public文件夹到本地分支。 合并分支到github(Commit)。 切回master分支。 Server Problems1Error: listen EADDRINUSE 你可能使用相同的端口,同时开启了两个Hexo服务器。如果需要同时开启,可以尝试修改端口设置: 1$ hexo server -p 5000 Plugin Installation Problems1npm ERR! node-waf configure build 这个错误可能发生在试图安装一个用Cc++或另一个javascript语言编写的插件。确保您已经安装了正确的编译器在您的计算机上。 Error with DTrace (Mac OS X)123{ [Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' } DTrace安装可能有问题,重装: 1$ npm install hexo --no-optional 详见 #1326 Iterate Data Model on Jade or SwigHexo使用仓库的数据模型。这不是一个数组,所以你可能需要将对象转换为iterable。 12{% for post in site.posts.toArray() %}{% endfor %} Data Not Updated一些数据不能更新或新生成的文件的最后一个版本完全相同。清理缓存,再试一次: 1$ hexo clean No command is executed那个不能使用除help、init和version以外的命令行(即Git Bash)时, 有可能时站点目录下的 package.json文件,缺少hexo ,如下: 12345{ "hexo": { "version": "3.2.2" }} Escape ContentsHexo使用Nunjucks渲染的页面. { { } }或{ % % }将解析和可能会引起麻烦, 如果要在博文中出现,必须使用三引号: 1 Hello {{ sensitive }} 12 ENOSPC Error (Linux)如果运行命令$ hexo server 返回一个错误: 1Error: watch ENOSPC ... 可以通过运行$ npm dedupe或者以下命令行(即Git Bash): 1$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p 来增加测试时,你可以看见的文件数量。 EMPERM Error (Windows Subsystem for Linux)如果在Windows Subsystem for Linux,运行命令$ hexo server 返回这个错误: 1Error: watch /path/to/hexo/theme/ EMPERM 因为目前在Windows Subsystem for Linux中,有些内容更改时,还不能实时更新到hexo服务器。 所以需要重新编译,再启动服务器: 12$ hexo generate$ hexo server -s Template render error有时运行命令$ hexo generate 返回一个错误: 12FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.htmlTemplate render error: (unknown path) 这意味着有些认不出来单词在你的文件,并且很可能在你的新博文,或者配置文件_config.yml中,比如缩进错误: 错误例子: 123plugins:hexo-generator-feedhexo-generator-sitemap ### 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之搜索服务]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-search%2F</url>
<content type="text"><![CDATA[搜索服务 推荐指数 优点 缺点 Local Search 4 配置方便 Swiftype 2 需注册 Algolia 2 需注册 Local Search添加百度/谷歌/本地 自定义站点内容搜索 安装 hexo-generator-searchdb,在站点的根目录下执行以下命令: 1$ npm install hexo-generator-searchdb --save 编辑 站点配置文件,新增以下内容到任意位置: 12345search: path: search.xml field: post format: html limit: 10000 编辑 主题配置文件,启用本地搜索功能: 123# Local searchlocal_search: enable: true ### 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之内容分享服务]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-share%2F</url>
<content type="text"><![CDATA[内容分享服务 推荐指数 优点 缺点 百度分享 4 稳定 不太美观 need-more-share2 4 美观 更新不及时(比如微信分享API) 百度分享编辑 主题配置文件,添加/修改字段 baidushare,值为 true即可。 12# 百度分享服务baidushare: true need-more-share2编辑 主题配置文件,添加/修改字段 needmoreshare2,值为 true即可。 12needmoreshare2: enable: true 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之数据统计与分析]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-analysis%2F</url>
<content type="text"><![CDATA[数据统计与分析 推荐指数 优点 缺点 不蒜子 4 可直接将访问次数显示在您在网页上(也可不显示) 只计数 百度统计 3 收录慢 不蒜子编辑 主题配置文件 themes/*/_config.yml中的busuanzi_count的配置项即可。 当enable: true时,代表开启全局开关。 若site_uv(本站访客数)、site_pv(本站访客数)、page_pv(本文总阅读量)的值均为false时,不蒜子仅作记录而不会在页面上显示。 注意: 1不蒜子官方因七牛强制过期原有的『dn-lbstatics.qbox.me』域名(预计2018年10月初),与客服沟通数次无果,即使我提出为此付费也不行,只能更换域名到『busuanzi.ibruce.info』! 解决办法: 找到主题调用不蒜子的swig文件。一般在”\themes*\layout_third-party\analytics\busuanzi-counter.swig” 更改域名 1234把原有的:<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>域名改一下即可:<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script> 百度统计 登录 百度统计,定位到站点的代码获取页面 复制统计脚本 id,如图: 编辑 主题配置文件themes/*/_config.yml,修改字段 google_analytics,值设置成你的统计脚本 id。 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之评论系统]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-comment%2F</url>
<content type="text"><![CDATA[评论系统 推荐指数 优点 缺点 Valine 4 每天30000条评论,10GB的储存 作者评论无标识 来必力/livere 4 多种账号登录 评论无法导出 畅言 3 美观 必须备案域名 gitment 3 简洁 只能登陆github评论 Disqus 1 需要翻*墙 Valine1.1. 获取APP ID 和 APP Key 请先登录或注册 LeanCloud, 进入控制台后点击左下角创建应用, 进入刚刚创建的应用,选择左下角的设置>应用Key,然后就能看到你的APP ID和APP Key了。 1.2. 填写APP ID 和 APP Key到主题配置文件_config.yml 1.3. 运行hexo g&&hexo d推送到博客。 来必力/livere2.1. 登陆 来必力 获取你的 LiveRe UID。 2.2. 填写LiveRe UID到主题配置文件_config.yml 畅言3.1.获取APP ID 和 APP Key 请先登录或注册 畅言, 点击“立即免费获取畅言”, 新建站点,点击管理,点击评论插件>评论管理, 点击后台总览,然后就能看到你的APP ID和APP Key了。 3.2. 填写APP ID 和 APP Key到主题配置文件_config.yml 3.3. 运行hexo g&&hexo d推送到博客。 gitment4.1. 安装插件: npm i –save gitment 4.2. 申请应用 在New OAuth App为你的博客应用一个密钥: 1234Application name:随便写Homepage URL:这个也可以随意写,就写你的博客地址就行Application description:描述,也可以随意写Authorization callback URL:这个必须写你的博客地址 4.3. 配置 编辑主题配置文件themes/*/_config.yml: 123456789101112131415# Gitment# Introduction: https://imsun.net/posts/gitment-introduction/gitment: enable: true mint: true # RECOMMEND, A mint on Gitment, to support count, language and proxy_gateway count: true # Show comments count in post meta area lazy: false # Comments lazy loading with a button cleanly: false # Hide 'Powered by ...' on footer, and more language: # Force language, or auto switch by theme github_user: {you github user id} github_repo: 公开的git仓库,评论会作为那个项目的issue client_id: {刚才申请的ClientID} client_secret: {刚才申请的Client Secret} proxy_gateway: # Address of api proxy, See: https://github.com/aimingoo/intersect redirect_protocol: # Protocol of redirect_uri with force_redirect_pro Disqus编辑 主题配置文件themes/*/_config.yml, 将 disqus 下的 enable 设定为 true,同时提供您的 shortname。count 用于指定是否显示评论数量。 1234disqus: enable: false shortname: count: true 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之添加萌萌哒]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-live2d%2F</url>
<content type="text"><![CDATA[添加萌萌哒 安装插件 1npm install --save hexo-helper-live2d 复制你喜欢的模型名字: Epsilon2.1 Gantzert_Felixander haru miku ni-j nico nietzche nipsilon nito shizuku tsumiki wanko z16 hibiki koharu haruto Unitychan tororo hijiki 将以下代码添加到主题配置文件_config.yml,修改<你喜欢的模型名字>: 12345678910111213141516live2d: enable: true scriptFrom: local pluginRootPath: live2dw/ pluginJsPath: lib/ pluginModelPath: assets/ tagMode: false log: false model: use: live2d-widget-model-<你喜欢的模型名字> display: position: right width: 150 height: 300 mobile: show: true 建配置文件 4.1. 在站点目录下建文件夹live2d_models, 4.2. 再在live2d_models下建文件夹<你喜欢的模型名字>, 4.3. 再在<你喜欢的模型名字>下建json文件:<你喜欢的模型名字>.model.json 安装模型。在命令行(即Git Bash)运行以下命令即可: npm install –save live2d-widget-model-<你喜欢的模型名字> 在命令行(即Git Bash)运行以下命令, 在http://127.0.0.1:4000/查看测试结果: hexo clean && hexo g && hexo s 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之加入广告]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-ad%2F</url>
<content type="text"><![CDATA[加入 广告主要有两种:百度SSP和谷歌Adsense。方法类似: 注册,复制广告代码 部署到网站。 2.1. 新建 theme/*/layout/_custom/google_ad.swig,将 AdSense 上的代码粘贴进去 2.2. 头部。在 theme/*/layout/_custom/head.swig 中也粘贴一份 2.3. 每篇博客。在 theme/*/layout/post.swig 里中在希望看到的地方加上: 1{% include '_custom/google_ad.swig' %} 例如:在 <div id="posts" class="posts-expand"> </div> 中间插入,总代码如下: 123456{% block content %} <div id="posts" class="posts-expand"> {{ post_template.render(page) }} {% include '_custom/google_ad.swig' %} </div>{% endblock %} 等待审核通过。如果失败,可再次申请。 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之创建分类页]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-categories%2F</url>
<content type="text"><![CDATA[创建分类页在终端窗口下,定位到 Hexo 站点目录下,新建: 12$ cd <站点目录>$ hexo new page categories ##### 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之显示当前浏览进度]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-process%2F</url>
<content type="text"><![CDATA[显示当前浏览进度修改themes/*/_config.yml,把 false 改为 true: 12345# Back to top in sidebarb2t: true# Scroll percent label in b2t buttonscrollpercent: true ##### 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之主页文章添加边框阴影效果]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-shadow%2F</url>
<content type="text"><![CDATA[主页文章添加边框阴影效果打开 themes/*/source/css/_custom/custom.styl ,向里面加代码: 12345678// 主页文章添加阴影效果.post { margin-top: 0px; margin-bottom: 60px; padding: 25px; -webkit-box-shadow: 0 0 5px rgba(202, 203, 203, .5); -moz-box-shadow: 0 0 5px rgba(202, 203, 204, .5);} 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之在右上角或者左上角实现fork me on github]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-forkMe%2F</url>
<content type="text"><![CDATA[在右上角或者左上角实现fork me on github 选择样式GitHub Ribbons, 修改图片跳转链接,将<a href="https://github.com/you">中的链接换为自己Github链接: 打开 themes/next/layout/_layout.swig 文件,把代码复制到<div class="headband"></div>下面。 ##### 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之修改访问URL路径]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-url%2F</url>
<content type="text"><![CDATA[修改访问URL路径默认情况下访问URL路径为:domain/2018/10/18/关于本站,修改为 domain/About/关于本站。 编辑 Hexo 站点下的 _config.yml 文件,修改其中的 permalink字段: 1permalink: :category/:title/ ##### 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之博文置顶]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-top%2F</url>
<content type="text"><![CDATA[博文置顶 安装插件 $ npm uninstall hexo-generator-index –save$ npm install hexo-generator-index-pin-top –save 然后在需要置顶的文章的Front-matter中加上top即可: 12345---title: 2018date: 2018-10-25 16:10:03top: 10--- 设置置顶标志 打开:/themes/*/layout/_macro/post.swig,定位到,插入以下代码即可: 12345{% if post.top %} <i class="fa fa-thumb-tack"></i> <font color=7D26CD>置顶</font> <span class="post-meta-divider">|</span>{% endif %} ##### 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之静态资源压缩]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-gulp%2F</url>
<content type="text"><![CDATA[静态资源压缩在站点目录下: 1$ npm install gulp -g 安装gulp插件: 12345npm install gulp-minify-css --savenpm install gulp-uglify --savenpm install gulp-htmlmin --savenpm install gulp-htmlclean --savenpm install gulp-imagemin --save 在 Hexo 站点下新建 gulpfile.js文件,文件内容如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445var gulp = require('gulp');var minifycss = require('gulp-minify-css');var uglify = require('gulp-uglify');var htmlmin = require('gulp-htmlmin');var htmlclean = require('gulp-htmlclean');var imagemin = require('gulp-imagemin');// 压缩css文件gulp.task('minify-css', function() { return gulp.src('./public/**/*.css') .pipe(minifycss()) .pipe(gulp.dest('./public'));});// 压缩html文件gulp.task('minify-html', function() { return gulp.src('./public/**/*.html') .pipe(htmlclean()) .pipe(htmlmin({ removeComments: true, minifyJS: true, minifyCSS: true, minifyURLs: true, })) .pipe(gulp.dest('./public'))});// 压缩js文件gulp.task('minify-js', function() { return gulp.src(['./public/**/.js','!./public/js/**/*min.js']) .pipe(uglify()) .pipe(gulp.dest('./public'));});// 压缩 public/demo 目录内图片gulp.task('minify-images', function() { gulp.src('./public/demo/**/*.*') .pipe(imagemin({ optimizationLevel: 5, //类型:Number 默认:3 取值范围:0-7(优化等级) progressive: true, //类型:Boolean 默认:false 无损压缩jpg图片 interlaced: false, //类型:Boolean 默认:false 隔行扫描gif进行渲染 multipass: false, //类型:Boolean 默认:false 多次优化svg直到完全优化 })) .pipe(gulp.dest('./public/uploads'));});// 默认任务gulp.task('default', [ 'minify-html','minify-css','minify-js','minify-images']); 只需要每次在执行 generate 命令后执行 gulp 就可以实现对静态资源的压缩,压缩完成后执行 deploy 命令同步到服务器: 123hexo ggulphexo d ##### 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之实现点击出现桃心效果]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-heart%2F</url>
<content type="text"><![CDATA[实现点击出现桃心效果 在/themes/*/source/js/src下新建文件click.js,接着把以下粘贴到click.js文件中。代码如下: 1!function(e,t,a){function n(){c(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"),o(),r()}function r(){for(var e=0;e<d.length;e++)d[e].alpha<=0?(t.body.removeChild(d[e].el),d.splice(e,1)):(d[e].y--,d[e].scale+=.004,d[e].alpha-=.013,d[e].el.style.cssText="left:"+d[e].x+"px;top:"+d[e].y+"px;opacity:"+d[e].alpha+";transform:scale("+d[e].scale+","+d[e].scale+") rotate(45deg);background:"+d[e].color+";z-index:99999");requestAnimationFrame(r)}function o(){var t="function"==typeof e.onclick&&e.onclick;e.onclick=function(e){t&&t(),i(e)}}function i(e){var a=t.createElement("div");a.className="heart",d.push({el:a,x:e.clientX-5,y:e.clientY-5,scale:1,alpha:1,color:s()}),t.body.appendChild(a)}function c(e){var a=t.createElement("style");a.type="text/css";try{a.appendChild(t.createTextNode(e))}catch(t){a.styleSheet.cssText=e}t.getElementsByTagName("head")[0].appendChild(a)}function s(){return"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}var d=[];e.requestAnimationFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)}}(),n()}(window,document); 在\themes\*\layout\_layout.swig文件末尾添加: 12<!-- 页面点击小红心 --><script type="text/javascript" src="/js/src/clicklove.js"></script> ##### 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之文章加密访问]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-textEncoding%2F</url>
<content type="text"><![CDATA[文章加密访问打开 themes/*/layout/_partials/head.swig文件,在 之前插入代码: 12345678910<script> (function(){ if('{{ page.password }}'){ if (prompt('请输入密码') !== '{{ page.password }}'){ alert('密码错误'); history.back(); } } })();</script> 写文章时加上password: *: 12345---title: 2018date: 2018-10-25 16:10:03password: 123456--- 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之自定义鼠标样式]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-mouse%2F</url>
<content type="text"><![CDATA[自定义鼠标样式打开 themes/*/source/css/_custom/custom.styl ,在里面写下如下代码: 1234567// 鼠标样式 * { cursor: url("http://om8u46rmb.bkt.clouddn.com/sword2.ico"),auto!important } :active { cursor: url("http://om8u46rmb.bkt.clouddn.com/sword1.ico"),auto!important } 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之网站标题栏背景颜色]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-titleBarColor%2F</url>
<content type="text"><![CDATA[网站标题栏背景颜色打开 themes/*/source/css/_custom/custom.styl ,在里面写下如下代码: 123.site-meta { background: $blue; //修改为自己喜欢的颜色} 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之修改内容区域的宽度]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-textLarge%2F</url>
<content type="text"><![CDATA[修改内容区域的宽度编辑主题的 source/css/_variables/custom.styl 文件,新增变量: 12345// 修改成你期望的宽度$content-desktop = 700px// 当视窗超过 1600px 后的宽度$content-desktop-large = 900px 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之修改Logo字体]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-logoFont%2F</url>
<content type="text"><![CDATA[修改Logo字体在 themes/*/source/css/_custom/custom.styl 中添加如下代码: 12345678@font-face { font-family: Zitiming; src: url('/fonts/Zitiming.ttf');}.site-title { font-size: 40px !important; font-family: 'Zitiming' !important;} 其中字体文件在 themes/next/source/fonts 目录下,里面有个 .gitkeep 的隐藏文件,打开写入你要保留的字体文件,比如我的是就是写入 Zitiming.ttf ,具体字库自己从网上下载即可。 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之添加背景图]]></title>
<url>%2F2018%2F11%2F16%2Fhexo-do-background%2F</url>
<content type="text"><![CDATA[添加背景图在 themes/*/source/css/_custom/custom.styl 中添加如下代码: 1234567body{ background:url(/images/bg.jpg); background-size:cover; background-repeat:no-repeat; background-attachment:fixed; background-position:center;} 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo之本地搭建博客]]></title>
<url>%2F2018%2F11%2F10%2Fhexo-local-build%2F</url>
<content type="text"><![CDATA[前言 欢迎在文末留言,或者点击加入QQ群933583982互相交流。 本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处! 搭建博客当你的电脑已经具备Hexo博客搭建环境时,现在就可以开始搭建博客了。 初始化Hexo在命令行(即Git Bash)依次运行以下命令即可: 以下,即存放Hexo初始化文件的路径, 即站点目录。 123$ hexo init <folder>$ cd <folder>$ npm install 新建完成后,在路径下,会产生这些文件和文件夹: 12345678.├── _config.yml├── package.json├── scaffolds├── source| ├── _drafts| └── _posts└── themes 注: hexo相关命令均在站点目录下,用Git Bash运行。 站点配置文件:站点目录下的_config.yml。 路径为<folder>\_config.yml 主题配置文件:站点目录下的themes文件夹下的,主题文件夹下的_config.yml。 路径为<folder>\themes\<主题文件夹>\_config.yml 启动服务器在路径下,命令行(即Git Bash)输入以下命令,运行即可: hexo server 访问浏览器访问网址: http://localhost:4000/ 关闭服务器在已启动服务器的命令行(即Git Bash)下,执行快捷键Ctrl+C,即可关闭服务器。 结语至此,您的Hexo博客已经搭建在本地,当启动服务器的时候,博客网址为: `http://localhost:4000/。 下一步:将博客推送到互联网。 如果本文对您有用,谢谢打赏。]]></content>
</entry>
<entry>
<title><![CDATA[Hexo之搭建环境]]></title>
<url>%2F2018%2F11%2F10%2Fhexo-env%2F</url>
<content type="text"><![CDATA[前言 欢迎在文末留言,或者点击加入QQ群933583982互相交流。 本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处! 准备环境Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。 然而安装 Hexo 前,您必须安装下列应用程序: Node.js Git Node.js本章节我们将向大家介绍在window和Linux上安装Node.js的方法。 本安装教程以Node.js v4.4.3 LTS(长期支持版本)版本为例。 Node.js安装包及源码下载地址为:https://nodejs.org/en/download/。 你可以根据不同平台系统选择你需要的Node.js安装包。 Node.js 历史版本下载地址:https://nodejs.org/dist/ 注意:Linux上安装Node.js需要安装Python 2.6 或 2.7 ,不建议安装Python 3.0以上版本。 Window 上安装Node.js你可以采用以下两种方式来安装。 1、Windows 安装包(.msi)32 位安装包下载地址 : https://nodejs.org/dist/v4.4.3/node-v4.4.3-x86.msi 64 位安装包下载地址 : https://nodejs.org/dist/v4.4.3/node-v4.4.3-x64.msi 本文实例以 v0.10.26 版本为例,其他版本类似, 安装步骤: 步骤 1 : 双击下载后的安装包 v0.10.26,如下所示: 步骤 2 : 点击以上的Run(运行),将出现如下界面: 步骤 3 : 勾选接受协议选项,点击 next(下一步) 按钮 : 步骤 4 : Node.js默认安装目录为 “C:\Program Files\nodejs\” , 你可以修改目录,并点击 next(下一步): 步骤 5 : 点击树形图标来选择你需要的安装模式 , 然后点击下一步 next(下一步) 步骤 6 :点击 Install(安装) 开始安装Node.js。你也可以点击 Back(返回)来修改先前的配置。 然后并点击 next(下一步): 安装过程: 点击 Finish(完成)按钮退出安装向导。 检测PATH环境变量是否配置了Node.js,点击开始=》运行=》输入”cmd” => 输入命令”path”,输出如下结果: 12345PATH=C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\python32\python;C:\MinGW\bin;C:\Program Files\GTK2-Runtime\lib;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files\nodejs\;C:\Users\rg\AppData\Roaming\npm 我们可以看到环境变量中已经包含了C:\Program Files\nodejs\ 检查Node.js版本 2、Windows 二进制文件 (.exe)安装 32 位安装包下载地址 : http://nodejs.org/dist/v0.10.26/node.exe 64 位安装包下载地址 : http://nodejs.org/dist/v0.10.26/x64/node.exe 安装步骤 步骤 1 : 双击下载的安装包 Node.exe ,将出现如下界面 : 点击 Run(运行)按钮将出现命令行窗口: 版本测试 进入 node.exe 所在的目录,如下所示: 如果你获得以上输出结果,说明你已经成功安装了Node.js。 Linux 上安装 Node.js直接使用已编译好的包Node 官网已经把 linux 下载版本更改为已编译好的版本了,我们可以直接下载解压后使用: 12345# wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz // 下载# tar xf node-v10.9.0-linux-x64.tar.xz // 解压# cd node-v10.9.0-linux-x64/ // 进入解压目录# ./bin/node -v // 执行node命令 查看版本v10.9.0 解压文件的 bin 目录底下包含了 node、npm 等命令,我们可以使用 ln 命令来设置软连接: 12ln -s /usr/software/nodejs/bin/npm /usr/local/bin/ ln -s /usr/software/nodejs/bin/node /usr/local/bin/ Ubuntu 源码安装 Node.js 以下部分我们将介绍在 Ubuntu Linux 下使用源码安装 Node.js 。 其他的 Linux 系统,如 Centos 等类似如下安装步骤。 在 Github 上获取 Node.js 源码: 12$ sudo git clone https://github.com/nodejs/node.gitCloning into 'node'... 修改目录权限: 1$ sudo chmod -R 755 node 使用 ./configure 创建编译文件,并按照: 1234$ cd node$ sudo ./configure$ sudo make$ sudo make install 查看 node 版本: 12$ node --versionv0.10.25 Ubuntu apt-get命令安装命令格式如下: 12sudo apt-get install nodejssudo apt-get install npm CentOS 下源码安装 Node.js1、下载源码,你需要在https://nodejs.org/en/download/下载最新的Nodejs版本,本文以v0.10.24为例: 12cd /usr/local/src/wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz 2、解压源码 1tar zxvf node-v0.10.24.tar.gz 3、 编译安装 1234cd node-v0.10.24./configure --prefix=/usr/local/node/0.10.24makemake install 4、 配置NODE_HOME,进入profile编辑环境变量 1vim /etc/profile 设置nodejs环境变量,在 *export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL* 一行的上面添加如下内容: 123#set for nodejsexport NODE_HOME=/usr/local/node/0.10.24export PATH=$NODE_HOME/bin:$PATH :wq保存并退出,编译/etc/profile 使配置生效 1source /etc/profile 验证是否安装配置成功 1node -v 输出 v0.10.24 表示配置成功 npm模块安装路径 1/usr/local/node/0.10.24/lib/node_modules/ 注:Nodejs 官网提供了编译好的Linux二进制包,你也可以下载下来直接应用。 Mac OS 上安装 你可以通过以下两种方式在 Mac OS 上来安装 node: 1、在 官方下载网站 下载 pkg 安装包,直接点击安装即可。 2、使用 brew 命令来安装: 1brew install node 在 Cloud Studio 中运行 node.js 程序Cloud Studio 已经为我提供了内置的 Node.js 开发环境,我们不仅可以通过切换运行环境来编写 Node.js 代码,也可以通过 访问链接 功能来实时查看代码的运行效果,下面我通过一个例子来展示: step1:访问Cloud Studio(https://studio.dev.tencent.com/),注册/登录账户。 step2:在右侧的运行环境菜单选择:"Node.js" 运行环境 step3:在左侧代码目录中新建Node.js代码目录编写你的 Node.js 代码 step4:进入 Node.js 代码目录运行 node hello.js 我们在代码中引入了 http 模块,并且通过http.createServer()方法创建了一个 http 服务器,通过listen() 方法绑定了 8888 端口 step5:点击最右侧的【访问链接】选项卡,在访问链接面板中填写端口号为:8888,点击创建链接,即可点击生成的链接访问我们的 Node.js 项目 1234567891011121314151617/*代码示例*/var http = require('http');http.createServer(function (request, response) { // 发送 HTTP 头部 // HTTP 状态值: 200 : OK // 内容类型: text/plain response.writeHead(200, {'Content-Type': 'text/plain'}); // 发送响应数据 "Hello World" response.end("Hello, Universe! I'm running on Cloud Studio!\n");}).listen(8888);// 终端打印如下信息console.log('Server running at http://127.0.0.1:8888/'); Tips: 从终端中输入命令可以看出 Cloud Studio 为我们集成了 Ubuntu16.04.1 + node8.10.0 的开发环境: 有任何疑问,可以查阅帮助文档 Git是时候动手尝试下 Git 了,不过得先安装好它。有许多种安装方式,主要分为两种,一种是通过编译源代码来安装;另一种是使用为特定平台预编译好的安装包。 从源代码安装若是条件允许,从源代码安装有很多好处,至少可以安装最新的版本。Git 的每个版本都在不断尝试改进用户体验,所以能通过源代码自己编译安装最新版本就再好不过了。有些 Linux 版本自带的安装包更新起来并不及时,所以除非你在用最新的 distro 或者 backports,那么从源代码安装其实该算是最佳选择。 Git 的工作需要调用 curl,zlib,openssl,expat,libiconv 等库的代码,所以需要先安装这些依赖工具。在有 yum 的系统上(比如 Fedora)或者有 apt-get 的系统上(比如 Debian 体系),可以用下面的命令安装: 12345$ yum install curl-devel expat-devel gettext-devel \ openssl-devel zlib-devel$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \ libz-dev libssl-dev 之后,从下面的 Git 官方站点下载最新版本源代码: 1http://git-scm.com/download 然后编译并安装: 1234$ tar -zxf git-1.7.2.2.tar.gz$ cd git-1.7.2.2$ make prefix=/usr/local all$ sudo make prefix=/usr/local install 现在已经可以用 git 命令了,用 git 把 Git 项目仓库克隆到本地,以便日后随时更新: 1$ git clone git://git.kernel.org/pub/scm/git/git.git 在 Linux 上安装如果要在 Linux 上安装预编译好的 Git 二进制安装包,可以直接用系统提供的包管理工具。在 Fedora 上用 yum 安装: 1$ yum install git-core 在 Ubuntu 这类 Debian 体系的系统上,可以用 apt-get 安装: 1$ apt-get install git 在 Mac 上安装在 Mac 上安装 Git 有两种方式。最容易的当属使用图形化的 Git 安装工具,界面如图 1-7,下载地址在: 1http://sourceforge.net/projects/git-osx-installer/ 图 1-7. Git OS X 安装工具 另一种是通过 MacPorts (http://www.macports.org) 安装。如果已经装好了 MacPorts,用下面的命令安装 Git: 1$ sudo port install git-core +svn +doc +bash_completion +gitweb 这种方式就不需要再自己安装依赖库了,Macports 会帮你搞定这些麻烦事。一般上面列出的安装选项已经够用,要是你想用 Git 连接 Subversion 的代码仓库,还可以加上 +svn 选项,具体将在第八章作介绍。(译注:还有一种是使用 homebrew(https://github.com/mxcl/homebrew):brew install git。) 在 Windows 上安装在 Windows 上安装 Git 同样轻松,有个叫做 msysGit 的项目提供了安装包,可以到 GitHub 的页面上下载 exe 安装文件并运行: 1http://msysgit.github.com/ 完成安装之后,就可以使用命令行的 git 工具(已经自带了 ssh 客户端)了,另外还有一个图形界面的 Git 项目管理工具。 给 Windows 用户的敬告:你应该在 msysGit 提供的 Unix 风格的 shell 来运行 Git。在 Unix 风格的 shell 中,可以使用本书中提及的复杂多行的命令。对于那些需要在 Windows 命令行中使用 Git 的用户,必须注意:在参数中间有空格的时候,必须使用双引号将参数括起来(在 Linux 中是单引号);另外,如果扬抑符(^)作为参数的结尾,并且作为这一行的最后一个字符,则这个参数也需要用双引号括起来。因为扬抑符在 Windows 命令行中表示续行(译注:即下一行为这一行命令的继续)。 Hexo安装Hexo,在命令行(即Git Bash)运行以下命令: npm install -g hexo-cli 至此Hexo的环境就搭建好了,下一步 初始化Hexo,在命令行(即Git Bash)依次运行以下命令即可: 以下,即存放Hexo初始化文件的路径, 即站点目录。 123$ hexo init <folder>$ cd <folder>$ npm install 新建完成后,在路径下,会产生这些文件和文件夹: 12345678.├── _config.yml├── package.json├── scaffolds├── source| ├── _drafts| └── _posts└── themes 注: hexo相关命令均在站点目录下,用Git Bash运行。 站点配置文件:站点目录下的_config.yml。 路径为<folder>\_config.yml 主题配置文件:站点目录下的themes文件夹下的,主题文件夹下的_config.yml。 路径为<folder>\themes\<主题文件夹>\_config.yml 启动服务器。在路径下,命令行(即Git Bash)输入以下命令,运行即可: hexo server 浏览器访问网址: http://localhost:4000/ 结语至此,您的Hexo博客环境已准备完毕,下一步:本地搭建博客。 如果本文对您有用,谢谢打赏。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Typora入门(中文版)]]></title>
<url>%2F2018%2F10%2F18%2FTypora%E5%85%A5%E9%97%A8%EF%BC%88%E4%B8%AD%E6%96%87%E7%89%88%EF%BC%89%2F</url>
<content type="text"><![CDATA[Typora简介 Typora删除了预览窗口,以及所有其他不必要的干扰。取而代之的是实时预览。 Markdown的语法因不同的解析器或编辑器而异,Typora使用的是GitHub Flavored Markdown。 下载Typora下载。 常用快捷键 加粗: Ctrl/Cmd + B 标题: Ctrl/Cmd + H 插入链接: Ctrl/Cmd + K 插入代码: Ctrl/Cmd + Shift + C 行内代码: Ctrl/Cmd + Shift + K 插入图片: Ctrl/Cmd + Shift + I 无序列表: Ctrl/Cmd + Shift + L 撤销: Ctrl/Cmd + Z 一级标题:快捷键为Crtl + 1,以此类推 块元素换行符在markdown中,段落由多个空格分隔。在Typora中,只需回车即可创建新段落。 标题级别 # 一级标题, 快捷键为Crtl + 1## 二级标题,快捷键为Crtl + 2###### 六级标题,快捷键为Crtl + 6 引用文字 > + 空格 + 引用文字 清单输入 列表内容 将创建一个无序列表,该符号可以替换为+或-。 输入1. 列表内容 将创建一个有序列表,其markdown源代码如下: 无序列表* AA* BB* CC 有序列表 AA BB CC 任务列表 - [ ] 不勾选- [x] 勾选 代码块在Typora中输入””” + 回车,并在后面选择一个语言名称即可语法高亮。 语法高亮: \123> def helloWorld():> print 'hello, world'> \ 数学表达式输入$$,然后按“回车”键,如下:$$\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}\mathbf{i} & \mathbf{j} & \mathbf{k} \\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \\end{vmatrix}$$ \$$\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}\mathbf{i} & \mathbf{j} & \mathbf{k} \\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \\end{vmatrix}\$$ 表输入`| 表头1 | 表头2 |`并回车。即可将创建一个包含两列的表,然后就像操作Word文档一样设置表格即可,没必要知道Markdown的复杂语法,因为这些语法会由Typora自动生成。效果如下: First Header Second Header 脚注 你可以创建一个脚注,像这样[^1].[^1]: 这是上面的注释内容。 你可以创建一个脚注,像这样^1. 注意:该例子脚注标识是1,脚注标识可以为字母数字下划线,但是暂不支持中文。脚注内容可为任意字符,包括中文。 分割线输入***或--- 再按回车即可绘制一条水平线,如下: YAML Front MatterTypora支持YAML Front Matter, 在文章开头输入---,然后按回车即可。 目录(TOC)输入[toc]然后回车,即可创建一个“目录”。TOC从文档中提取所有标题,其内容将自动更新。 跨度元素跨度元素即图片,网址,视频等,在Typora中输入后,会立即载入并呈现。 链接内部链接 这是一个带有标题属性的[链接](http://example.com/ “标题”).这是一个没有标题属性的[链接](http://example.net/). 效果如下: 这是一个带有标题属性的链接.这是一个没有标题属性的链接. 参考链接 这是一个[参考链接]id。[id]: http://example.com/ “标题” 这是一个参考链接。 网址Typora允许用<括号括起来>, 把URL作为链接插入。输入\td_simon@outlook.com 即 td_simon@outlook.com。Typora还会自动链接标准网址。例如:www.simon96.online。 图片  倾斜 *单个星号*_单下划线_ 效果如下:单个星号 单下划线 加粗 *两个星号*_双下划线_ 效果如下:两个星号双下划线 代码标记标记代码使用反引号,即在英文输入法下,ESC键下面和1键左边的符号——` 使用该`printf()`功能。效果如下:使用该printf()功能。 删除线 ~~删除线~~ 效果如下: 删除线 下划线\下划线 效果如下: 下划线 表情符号:smile: :smile :(注意为:是英文的冒号) :smile: 下标H~2~O (需在设置中打开该功能) 上标X^2^(需在设置中打开该功能) 高亮 ==高亮==(需在设置中打开该功能) HTML支持HTML 嵌入内容支持iframe-based嵌入代码, < iframe height=’265’ scrolling=’no’ title=’Fancy Animated SVG Menu’ src=’http://codepen.io/jeangontijo/embed/OxVywj/?height=265&theme-id=0&default-tab=css,result&embed-version=2' frameborder=’no’ allowtransparency=’true’ allowfullscreen=’true’ style=’width: 100%;’> 视频 < video src=”xxx.mp4” /> 总结: 建议打开大纲视图(快捷键ctrl + shift + 1)。 插入表格需要顶格写,不然显示不出来。 以上语法不用刻意记,在Typora中的右键菜单都有, 常用功能基本上都有快捷键。 感谢支持 昵称 支持方式 数目 备注信息 null 微信 5 神器 MaydayPeanut 支付宝 0.66 真的6 追 支付宝 6 这波可以的 鎖謔訫 支付宝 1 null 微信打赏看不到名字,但是还是很感谢,持续更新中。。。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[【持续更新】最全Hexo博客搭建+主题优化+插件配置+常用操作+错误分析]]></title>
<url>%2F2018%2F10%2F12%2Fhexo-tutorial%2F</url>
<content type="text"><![CDATA[前言 欢迎在文末留言,或者点击加入QQ群933583982互相交流。 本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处! 博客搭建准备环境 Node.js 下载,并安装。详细步骤:https://www.simon96.online/2018/11/10/hexo-env/ Git 下载,并安装。详细步骤:https://www.simon96.online/2018/11/10/hexo-env/ 安装Hexo,在命令行(即Git Bash)运行以下命令: npm install -g hexo-cli 初始化Hexo,在命令行(即Git Bash)依次运行以下命令即可: 以下,即存放Hexo初始化文件的路径, 即站点目录。 123$ hexo init <folder>$ cd <folder>$ npm install 新建完成后,在路径下,会产生这些文件和文件夹: 12345678.├── _config.yml├── package.json├── scaffolds├── source| ├── _drafts| └── _posts└── themes 注: hexo相关命令均在站点目录下,用Git Bash运行。 站点配置文件:站点目录下的_config.yml。 路径为<folder>\_config.yml 主题配置文件:站点目录下的themes文件夹下的,主题文件夹下的_config.yml。 路径为<folder>\themes\<主题文件夹>\_config.yml 启动服务器。在路径下,命令行(即Git Bash)输入以下命令,运行即可: hexo server 浏览器访问网址: http://localhost:4000/ 至此,您的Hexo博客已经搭建在本地。 实施方案方案一:GithubPages 创建Github账号 创建仓库, 仓库名为:<Github账号名称>.github.io 将本地Hexo博客推送到GithubPages 3.1. 安装hexo-deployer-git插件。在命令行(即Git Bash)运行以下命令即可: 1$ npm install hexo-deployer-git --save 3.2. 添加SSH key。 创建一个 SSH key 。在命令行(即Git Bash)输入以下命令, 回车三下即可: 1$ ssh-keygen -t rsa -C "邮箱地址" 添加到 github。 复制密钥文件内容(路径形如C:\Users\Administrator\.ssh\id_rsa.pub),粘贴到New SSH Key即可。 测试是否添加成功。在命令行(即Git Bash)依次输入以下命令,返回“You’ve successfully authenticated”即成功: 12$ ssh -T [email protected]$ yes 3.3. 修改_config.yml(在站点目录下)。文件末尾修改为: 123456# Deployment## Docs: https://hexo.io/docs/deployment.htmldeploy: type: git repo: [email protected]:<Github账号名称>/<Github账号名称>.github.io.git branch: master 注意:上面仓库地址写ssh地址,不写http地址。 3.4. 推送到GithubPages。在命令行(即Git Bash)依次输入以下命令, 返回INFO Deploy done: git即成功推送: 12$ hexo g$ hexo d 等待1分钟左右,浏览器访问网址: https://<Github账号名称>.github.io 至此,您的Hexo博客已经搭建在GithubPages, 域名为https://<Github账号名称>.github.io。 方案二:GithubPages + 域名在方案一的基础上,添加自定义域名(您购买的域名)。 域名解析。 类型选择为 CNAME; 主机记录即域名前缀,填写为www; 记录值填写为自定义域名; 解析线路,TTL 默认即可。 仓库设置。 2.1. 打开博客仓库设置:https://github.com/<Github账号名称>/<Github账号名称>.github.io/settings 2.2. 在Custom domain下,填写自定义域名,点击save。 2.3. 在站点目录的source文件夹下,创建并打开CNAME.txt,写入你的域名(如www.simon96.online),保存,并重命名为CNAME。 等待10分钟左右。 浏览器访问自定义域名。 至此,您的Hexo博客已经解析到自定义域名,https://<Github账号名称>.github.io依然可用。 方案三:GithubPages + CodingPages + 域名GithubPages 在国内较慢,百度不收录,而CodingPages 在国外较快。所以在方案二的基础上,添加CodingPages 。 创建Coding账号 创建仓库, 仓库名为:<Coding账号名称> 进入项目里『代码』页面,点击『一键开启静态 Pages』,稍等片刻CodingPages即可部署成功。 将本地Hexo博客推送到CodingPages 4.1. 鉴于创建GithubPages 时,已经生成过公钥。可直接复制密钥文件内容(路径形如C:\Users\Administrator\.ssh\id_rsa.pub), 粘贴到新增公钥。 4.2. 测试是否添加成功。在命令行(即Git Bash)依次输入以下命令,返回“You’ve successfully authenticated”即成功: 12$ ssh -T [email protected]$ yes 4.3. 修改_config.yml(在存放Hexo初始化文件的路径下)。文件末尾修改为: 123456789# Deployment## Docs: https://hexo.io/docs/deployment.htmldeploy:- type: git repo: [email protected]:<Github账号名称>/<Github账号名称>.github.io.git branch: master- type: git repo: [email protected]:<Coding账号名称>/<Coding账号名称>.git branch: master 4.4. 推送到GithubPages。在命令行(即Git Bash)依次输入以下命令, 返回INFO Deploy done: git即成功推送: 12$ hexo g$ hexo d 域名解析 添加 CNAME 记录指向 <Coding账号名称>.coding.me 类型选择为 CNAME; 主机记录即域名前缀,填写为www; 记录值填写为自定义域名; 解析线路,TTL 默认即可。 添加 两条A 记录指向 192.30.252.153和192.30.252.154 类型选择为 A; 主机记录即域名前缀,填写为@; 记录值填写为192.30.252.153和192.30.252.154; 解析线路,境外或谷歌。 在『Pages 服务』设置页(https://dev.tencent.com/u/<Coding账号名称>/p/<Coding账号名称>/git/pages/settings)中绑定自定义域名。 至此,您的Hexo博客已经解析到自定义域名,https://<Github账号名称>.github.io和https://<Coding账号名称>.coding.me依然可用。 方案四:云服务器 + 域名该方案需要先购买云服务器和域名。 在云服务器安装Git 和 Nginx。(Git 用于版本管理和部署,Nginx 用于静态博客托管。) 登陆root用户,运行: 12$ yum -y update$ yum install -y git nginx Nginx配置 2.1. 创建文件目录(用于博客站点文件存放) 123cd /usr/local/mkdir hexochmod 775 -R /usr/local/hexo/ 2.2. 添加 index.html(用于检测配置 Nginx 是否成功) 1vim /usr/local/hexo/index.html 添加以下代码,并保存。 12345678910<!DOCTYPE html><html> <head> <title></title> <meta charset="UTF-8"> </head> <body> <p>Nginx running</p> </body></html> 2.3. 配置 Nginx 服务器 1vim /etc/nginx/nginx.conf 修改server_name和root: 123456server { listen 80 default_server; listen [::]:80 default_server; server_name www.baidu.com; # 填个人域名 root /usr/local/hexo/; } 2.4. 启动nginx服务; 1service nginx start 2.5. 云服务器浏览器访问个人域名或IP,若跳转index.html,则配置完成,否则检查以上配置。 git配置 3.1. 创建文件目录, 用于私人 Git 仓库搭建, 并更改目录读写权限。 123cd /usr/local/mkdir hexoRepochmod 775 -R /usr/local/hexoRepo/ 3.2. Git 初始化裸库。 12cd hexoRepo/git init --bare hexo.git 3.3. 创建 Git 钩子(hook)。 1vim /usr/local/hexoRepo/hexo.git/hooks/post-receive 3.4. 输入以下信息,用于指定 Git 的源代码 和 Git 配置文件。 123#!/bin/bashgit --work-tree=/usr/local/hexo --git-dir=/usr/local/hexoRepo/hexo.git checkout -f 3.5. 保存并退出后, 给该文件添加可执行权限。 1chmod +x /usr/local/hexoRepo/hexo.git/hooks/post-receive 本地博客推送到云服务器 4.1. 安装hexo-deployer-git插件。在命令行(即Git Bash)运行以下命令即可: 1$ npm install hexo-deployer-git --save 4.2. 添加SSH key。 创建一个 SSH key 。在命令行(即Git Bash)输入以下命令, 回车三下即可: 1$ ssh-keygen -t rsa -C "邮箱地址" 添加到 github。 复制密钥文件内容(路径形如C:\Users\Administrator\.ssh\id_rsa.pub),粘贴到New SSH Key即可。 测试是否添加成功。在命令行(即Git Bash)依次输入以下命令,返回“You’ve successfully authenticated”即成功: 12$ ssh -T [email protected]$ yes 4.3. 修改_config.yml(在站点目录下)。文件末尾修改为: 123456# Deployment## Docs: https://hexo.io/docs/deployment.htmldeploy: type: git repo: [email protected]:/usr/local/hexoRepo/hexo //用户名@域名或 IP 地址:/usr/local/hexoRepo/hexo branch: master 注意:上面仓库地址写ssh地址,不写http地址。 4.4. 推送到GithubPages。在命令行(即Git Bash)依次输入以下命令, 返回INFO Deploy done: git即成功推送: 12$ hexo g$ hexo d 等待1分钟左右,浏览器访问个人域名。 至此,您的Hexo博客已经搭建在云服务器, 域名为个人域名。 主题优化选择主题Hexo默认的主题是landscape,推荐以下主题: snippet Hiero JSimple BlueLake 详见:https://github.com/search?q=hexo-theme 应用主题 下载主题 将下载好的主题文件夹,粘贴到站点目录的themes下。 更改站点配置文件_config.yml 的theme字段,为主题文件夹的名称: 1234# Extensions## Plugins: https://hexo.io/plugins/## Themes: https://hexo.io/themes/theme: <主题文件夹的名称> 主题优化以上主题都有比较详细的说明文档,本节主要解决主题优化的常见问题。 主题优化一般包括: 设置「RSS」 添加「标签」页面 添加「分类」页面 设置「字体」 问题:引用国外字体镜像较慢。 解决:可以改用国内的。将\themes\*\layout_partials\head external-fonts.swig文件中fonts.google.com改成fonts.lug.ustc.edu.cn。 设置「代码高亮主题」 侧边栏社交链接 问题:图标哪里找? 解决:Font Awesome 开启打赏功能 问题:微信支付宝二维码不美观,规格不一。 解决:在线生成二维码 设置友情链接 腾讯公益404页面 站点建立时间 订阅微信公众号 设置「动画效果」 问题:慢,需要等待 JavaScript 脚本完全加载完毕后才会显示内容。解决:将主题配置文件_config.yml中,use_motion字段的值设为 false 来关闭动画。 设置「背景动画」 主题优化还包括: 添加背景图在 themes/*/source/css/_custom/custom.styl 中添加如下代码: 1234567body{ background:url(/images/bg.jpg); background-size:cover; background-repeat:no-repeat; background-attachment:fixed; background-position:center;} 修改Logo字体在 themes/*/source/css/_custom/custom.styl 中添加如下代码: 12345678@font-face { font-family: Zitiming; src: url('/fonts/Zitiming.ttf');}.site-title { font-size: 40px !important; font-family: 'Zitiming' !important;} 其中字体文件在 themes/next/source/fonts 目录下,里面有个 .gitkeep 的隐藏文件,打开写入你要保留的字体文件,比如我的是就是写入 Zitiming.ttf ,具体字库自己从网上下载即可。 修改内容区域的宽度编辑主题的 source/css/_variables/custom.styl 文件,新增变量: 12345// 修改成你期望的宽度$content-desktop = 700px// 当视窗超过 1600px 后的宽度$content-desktop-large = 900px 网站标题栏背景颜色打开 themes/*/source/css/_custom/custom.styl ,在里面写下如下代码: 123.site-meta { background: $blue; //修改为自己喜欢的颜色} 自定义鼠标样式打开 themes/*/source/css/_custom/custom.styl ,在里面写下如下代码: 1234567// 鼠标样式 * { cursor: url("http://om8u46rmb.bkt.clouddn.com/sword2.ico"),auto!important } :active { cursor: url("http://om8u46rmb.bkt.clouddn.com/sword1.ico"),auto!important } 文章加密访问打开 themes/*/layout/_partials/head.swig文件,在 之前插入代码: 12345678910<script> (function(){ if('{{ page.password }}'){ if (prompt('请输入密码') !== '{{ page.password }}'){ alert('密码错误'); history.back(); } } })();</script> 写文章时加上password: *: 12345---title: 2018date: 2018-10-25 16:10:03password: 123456--- 实现点击出现桃心效果 在/themes/*/source/js/src下新建文件click.js,接着把以下粘贴到click.js文件中。代码如下: 1!function(e,t,a){function n(){c(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"),o(),r()}function r(){for(var e=0;e<d.length;e++)d[e].alpha<=0?(t.body.removeChild(d[e].el),d.splice(e,1)):(d[e].y--,d[e].scale+=.004,d[e].alpha-=.013,d[e].el.style.cssText="left:"+d[e].x+"px;top:"+d[e].y+"px;opacity:"+d[e].alpha+";transform:scale("+d[e].scale+","+d[e].scale+") rotate(45deg);background:"+d[e].color+";z-index:99999");requestAnimationFrame(r)}function o(){var t="function"==typeof e.onclick&&e.onclick;e.onclick=function(e){t&&t(),i(e)}}function i(e){var a=t.createElement("div");a.className="heart",d.push({el:a,x:e.clientX-5,y:e.clientY-5,scale:1,alpha:1,color:s()}),t.body.appendChild(a)}function c(e){var a=t.createElement("style");a.type="text/css";try{a.appendChild(t.createTextNode(e))}catch(t){a.styleSheet.cssText=e}t.getElementsByTagName("head")[0].appendChild(a)}function s(){return"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}var d=[];e.requestAnimationFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)}}(),n()}(window,document); 在\themes\*\layout\_layout.swig文件末尾添加: 12<!-- 页面点击小红心 --><script type="text/javascript" src="/js/src/clicklove.js"></script> 静态资源压缩在站点目录下: 1$ npm install gulp -g 安装gulp插件: 12345npm install gulp-minify-css --savenpm install gulp-uglify --savenpm install gulp-htmlmin --savenpm install gulp-htmlclean --savenpm install gulp-imagemin --save 在 Hexo 站点下新建 gulpfile.js文件,文件内容如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445var gulp = require('gulp');var minifycss = require('gulp-minify-css');var uglify = require('gulp-uglify');var htmlmin = require('gulp-htmlmin');var htmlclean = require('gulp-htmlclean');var imagemin = require('gulp-imagemin');// 压缩css文件gulp.task('minify-css', function() { return gulp.src('./public/**/*.css') .pipe(minifycss()) .pipe(gulp.dest('./public'));});// 压缩html文件gulp.task('minify-html', function() { return gulp.src('./public/**/*.html') .pipe(htmlclean()) .pipe(htmlmin({ removeComments: true, minifyJS: true, minifyCSS: true, minifyURLs: true, })) .pipe(gulp.dest('./public'))});// 压缩js文件gulp.task('minify-js', function() { return gulp.src(['./public/**/.js','!./public/js/**/*min.js']) .pipe(uglify()) .pipe(gulp.dest('./public'));});// 压缩 public/demo 目录内图片gulp.task('minify-images', function() { gulp.src('./public/demo/**/*.*') .pipe(imagemin({ optimizationLevel: 5, //类型:Number 默认:3 取值范围:0-7(优化等级) progressive: true, //类型:Boolean 默认:false 无损压缩jpg图片 interlaced: false, //类型:Boolean 默认:false 隔行扫描gif进行渲染 multipass: false, //类型:Boolean 默认:false 多次优化svg直到完全优化 })) .pipe(gulp.dest('./public/uploads'));});// 默认任务gulp.task('default', [ 'minify-html','minify-css','minify-js','minify-images']); 只需要每次在执行 generate 命令后执行 gulp 就可以实现对静态资源的压缩,压缩完成后执行 deploy 命令同步到服务器: 123hexo ggulphexo d 修改访问URL路径默认情况下访问URL路径为:domain/2018/10/18/关于本站,修改为 domain/About/关于本站。 编辑 Hexo 站点下的 _config.yml 文件,修改其中的 permalink字段: 1permalink: :category/:title/ 博文置顶 安装插件 $ npm uninstall hexo-generator-index –save$ npm install hexo-generator-index-pin-top –save 然后在需要置顶的文章的Front-matter中加上top即可: 12345---title: 2018date: 2018-10-25 16:10:03top: 10--- 设置置顶标志 打开:/themes/*/layout/_macro/post.swig,定位到,插入以下代码即可: 12345{% if post.top %} <i class="fa fa-thumb-tack"></i> <font color=7D26CD>置顶</font> <span class="post-meta-divider">|</span>{% endif %} 在右上角或者左上角实现fork me on github 选择样式GitHub Ribbons, 修改图片跳转链接,将<a href="https://github.com/you">中的链接换为自己Github链接: 打开 themes/next/layout/_layout.swig 文件,把代码复制到<div class="headband"></div>下面。 主页文章添加边框阴影效果打开 themes/*/source/css/_custom/custom.styl ,向里面加代码: 12345678// 主页文章添加阴影效果.post { margin-top: 0px; margin-bottom: 60px; padding: 25px; -webkit-box-shadow: 0 0 5px rgba(202, 203, 203, .5); -moz-box-shadow: 0 0 5px rgba(202, 203, 204, .5);} 显示当前浏览进度修改themes/*/_config.yml,把 false 改为 true: 12345# Back to top in sidebarb2t: true# Scroll percent label in b2t buttonscrollpercent: true 创建分类页在终端窗口下,定位到 Hexo 站点目录下,新建: 12$ cd <站点目录>$ hexo new page categories 加入 广告主要有两种:百度SSP和谷歌Adsense。方法类似: 注册,复制广告代码 部署到网站。 2.1. 新建 theme/*/layout/_custom/google_ad.swig,将 AdSense 上的代码粘贴进去 2.2. 头部。在 theme/*/layout/_custom/head.swig 中也粘贴一份 2.3. 每篇博客。在 theme/*/layout/post.swig 里中在希望看到的地方加上: 1{% include '_custom/google_ad.swig' %} 例如:在 <div id="posts" class="posts-expand"> </div> 中间插入,总代码如下: 123456{% block content %} <div id="posts" class="posts-expand"> {{ post_template.render(page) }} {% include '_custom/google_ad.swig' %} </div>{% endblock %} 等待审核通过。如果失败,可再次申请。 添加萌萌哒 安装插件 1npm install --save hexo-helper-live2d 复制你喜欢的模型名字: Epsilon2.1 Gantzert_Felixander haru miku ni-j nico nietzche nipsilon nito shizuku tsumiki wanko z16 hibiki koharu haruto Unitychan tororo hijiki 将以下代码添加到主题配置文件_config.yml,修改<你喜欢的模型名字>: 12345678910111213141516live2d: enable: true scriptFrom: local pluginRootPath: live2dw/ pluginJsPath: lib/ pluginModelPath: assets/ tagMode: false log: false model: use: live2d-widget-model-<你喜欢的模型名字> display: position: right width: 150 height: 300 mobile: show: true 建配置文件 4.1. 在站点目录下建文件夹live2d_models, 4.2. 再在live2d_models下建文件夹<你喜欢的模型名字>, 4.3. 再在<你喜欢的模型名字>下建json文件:<你喜欢的模型名字>.model.json 安装模型。在命令行(即Git Bash)运行以下命令即可: npm install –save live2d-widget-model-<你喜欢的模型名字> 在命令行(即Git Bash)运行以下命令, 在http://127.0.0.1:4000/查看测试结果: hexo clean && hexo g && hexo s 插件配置以下插件(评论系统、数据统计与分析、内容分享服务、搜索服务)各选一个即可。 评论系统 推荐指数 优点 缺点 Valine 4 每天30000条评论,10GB的储存 作者评论无标识 来必力/livere 4 多种账号登录 评论无法导出 畅言 3 美观 必须备案域名 gitment 3 简洁 只能登陆github评论 Disqus 1 需要翻*墙 Valine1.1. 获取APP ID 和 APP Key 请先登录或注册 LeanCloud, 进入控制台后点击左下角创建应用, 进入刚刚创建的应用,选择左下角的设置>应用Key,然后就能看到你的APP ID和APP Key了。 1.2. 填写APP ID 和 APP Key到主题配置文件_config.yml 1.3. 运行hexo g&&hexo d推送到博客。 来必力/livere2.1. 登陆 来必力 获取你的 LiveRe UID。 2.2. 填写LiveRe UID到主题配置文件_config.yml 畅言3.1.获取APP ID 和 APP Key 请先登录或注册 畅言, 点击“立即免费获取畅言”, 新建站点,点击管理,点击评论插件>评论管理, 点击后台总览,然后就能看到你的APP ID和APP Key了。 3.2. 填写APP ID 和 APP Key到主题配置文件_config.yml 3.3. 运行hexo g&&hexo d推送到博客。 gitment4.1. 安装插件: npm i –save gitment 4.2. 申请应用 在New OAuth App为你的博客应用一个密钥: 1234Application name:随便写Homepage URL:这个也可以随意写,就写你的博客地址就行Application description:描述,也可以随意写Authorization callback URL:这个必须写你的博客地址 4.3. 配置 编辑主题配置文件themes/*/_config.yml: 123456789101112131415# Gitment# Introduction: https://imsun.net/posts/gitment-introduction/gitment: enable: true mint: true # RECOMMEND, A mint on Gitment, to support count, language and proxy_gateway count: true # Show comments count in post meta area lazy: false # Comments lazy loading with a button cleanly: false # Hide 'Powered by ...' on footer, and more language: # Force language, or auto switch by theme github_user: {you github user id} github_repo: 公开的git仓库,评论会作为那个项目的issue client_id: {刚才申请的ClientID} client_secret: {刚才申请的Client Secret} proxy_gateway: # Address of api proxy, See: https://github.com/aimingoo/intersect redirect_protocol: # Protocol of redirect_uri with force_redirect_pro Disqus编辑 主题配置文件themes/*/_config.yml, 将 disqus 下的 enable 设定为 true,同时提供您的 shortname。count 用于指定是否显示评论数量。 1234disqus: enable: false shortname: count: true 数据统计与分析 推荐指数 优点 缺点 不蒜子 4 可直接将访问次数显示在您在网页上(也可不显示) 只计数 百度统计 3 收录慢 不蒜子编辑 主题配置文件 themes/*/_config.yml中的busuanzi_count的配置项即可。 当enable: true时,代表开启全局开关。 若site_uv(本站访客数)、site_pv(本站访客数)、page_pv(本文总阅读量)的值均为false时,不蒜子仅作记录而不会在页面上显示。 注意: 1不蒜子官方因七牛强制过期原有的『dn-lbstatics.qbox.me』域名(预计2018年10月初),与客服沟通数次无果,即使我提出为此付费也不行,只能更换域名到『busuanzi.ibruce.info』! 解决办法: 找到主题调用不蒜子的swig文件。一般在”\themes*\layout_third-party\analytics\busuanzi-counter.swig” 更改域名 1234把原有的:<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>域名改一下即可:<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script> 百度统计 登录 百度统计,定位到站点的代码获取页面 复制统计脚本 id,如图: 编辑 主题配置文件themes/*/_config.yml,修改字段 google_analytics,值设置成你的统计脚本 id。 内容分享服务 推荐指数 优点 缺点 百度分享 4 稳定 不太美观 need-more-share2 4 美观 更新不及时(比如微信分享API) 百度分享编辑 主题配置文件,添加/修改字段 baidushare,值为 true即可。 12# 百度分享服务baidushare: true need-more-share2编辑 主题配置文件,添加/修改字段 needmoreshare2,值为 true即可。 12needmoreshare2: enable: true 搜索服务 推荐指数 优点 缺点 Local Search 4 配置方便 Swiftype 2 需注册 Algolia 2 需注册 Local Search添加百度/谷歌/本地 自定义站点内容搜索 安装 hexo-generator-searchdb,在站点的根目录下执行以下命令: 1$ npm install hexo-generator-searchdb --save 编辑 站点配置文件,新增以下内容到任意位置: 12345search: path: search.xml field: post format: html limit: 10000 编辑 主题配置文件,启用本地搜索功能: 123# Local searchlocal_search: enable: true 错误分析如果你使用Hexo遇到同样的问题,这里有一些常见问题的解决方案。 YAML Parsing Error12JS-YAML: incomplete explicit mapping pair; a key node is missed at line 18, column 29: last_updated: Last updated: %s 参数中包含冒号,请用加引号,如Last updated: %s 12JS-YAML: bad indentation of a mapping entry at line 18, column 31: last_updated:"Last updated: %s" 字段后面的冒号必须为英文冒号,如:last_updated: 字段冒号后面必须跟一个空格,如:last_updated: “Last updated: %s” EMFILE Error1Error: EMFILE, too many open files 生成大量的文件时,可能遇到EMFILE错误。 可以运行以下命令来增加允许同步I / O操作的数量。 1$ ulimit -n 10000 Process Out of Memory当hexo g时,遇到以下错误: 1FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory 如下,更改hexo-cli文件的第一行,来增大nodejs堆内存.该bug已在新版本修复。 1#!/usr/bin/env node --max_old_space_size=8192 Git Deployment Problems RPC failed 123error: RPC failed; result=22, HTTP code = 403fatal: 'username.github.io' does not appear to be a git repository 确保你有你的电脑上设置git正确或尝试使用HTTPS存储库URL。 Error: ENOENT: no such file or directory 这个需要有一定的git的知识,因为可能是由于写错了标签,类别,或文件名,导致本地和github冲突了,Git不能自动合并这一变化所以它打破了自动分支。 解决办法: 检查文章的标签和类别,确保本地和github上是相同的。 合并分支(Commit)。 清除,重构。在站点目录下,命令行(即Git Bash)运行hexo clean和hexo g 手动将站点目录下的public文件夹复制到您的桌面 从你的master分支切换到部署在本地分支。 从桌面复制public文件夹到本地分支。 合并分支到github(Commit)。 切回master分支。 Server Problems1Error: listen EADDRINUSE 你可能使用相同的端口,同时开启了两个Hexo服务器。如果需要同时开启,可以尝试修改端口设置: 1$ hexo server -p 5000 Plugin Installation Problems1npm ERR! node-waf configure build 这个错误可能发生在试图安装一个用Cc++或另一个javascript语言编写的插件。确保您已经安装了正确的编译器在您的计算机上。 Error with DTrace (Mac OS X)123{ [Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' } DTrace安装可能有问题,重装: 1$ npm install hexo --no-optional 详见 #1326 Iterate Data Model on Jade or SwigHexo使用仓库的数据模型。这不是一个数组,所以你可能需要将对象转换为iterable。 12{% for post in site.posts.toArray() %}{% endfor %} Data Not Updated一些数据不能更新或新生成的文件的最后一个版本完全相同。清理缓存,再试一次: 1$ hexo clean No command is executed那个不能使用除help、init和version以外的命令行(即Git Bash)时, 有可能时站点目录下的 package.json文件,缺少hexo ,如下: 12345{ "hexo": { "version": "3.2.2" }} Escape ContentsHexo使用Nunjucks渲染的页面. { { } }或{ % % }将解析和可能会引起麻烦, 如果要在博文中出现,必须使用三引号: 1 Hello {{ sensitive }} 12345```#### ENOSPC Error (Linux)如果运行命令`$ hexo server` 返回一个错误: Error: watch ENOSPC …12可以通过运行`$ npm dedupe`或者以下命令行(即Git Bash): $ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p123456来增加测试时,你可以看见的文件数量。#### EMPERM Error (Windows Subsystem for Linux)如果在Windows Subsystem for Linux,运行命令`$ hexo server` 返回这个错误: Error: watch /path/to/hexo/theme/ EMPERM1234因为目前在Windows Subsystem for Linux中,有些内容更改时,还不能实时更新到hexo服务器。所以需要重新编译,再启动服务器: $ hexo generate$ hexo server -s123456#### Template render error有时运行命令`$ hexo generate` 返回一个错误: FATAL Something’s wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.htmlTemplate render error: (unknown path)1234这意味着有些认不出来单词在你的文件,并且很可能在你的新博文,或者配置文件`_config.yml`中,比如缩进错误:错误例子: plugins:hexo-generator-feedhexo-generator-sitemap` 常用操作创建文章命令: $ hexo new [layout] <title> 参数说明: [layout]可以为以下三种: 参数名 功能 文章路径 post 新建博文 source/_posts page 新建页面(如404,分类) source draft 草稿 source/_drafts 草稿可通过一下命令发布: $ hexo publish [layout] <title> title注意: 不是博文标题, 是博文markdown文件的名字, 也是博文链接的后缀(如https://www.simon96.online/2018/10/12/hexo-tutorial/中的hexo-tutorial) 文章模版 创建模版 在新建文章时,Hexo 会根据 scaffolds 文件夹内相对应的文件来建立文件,例如: $ hexo new blog “simon” 在执行这行指令时,Hexo 会尝试在 scaffolds 文件夹中寻找 blog.md,并根据其内容建立文章。 修改参数 以下是您可以在模版中使用的变量: 变量 描述 layout 布局 title 标题 date 文件建立日期 Front-matter就是博文最上方以 --- 分隔的那部分。 默认可以使用的Front-matter: 参数 描述 默认值 layout 布局 title 标题 date 建立日期 文件建立日期 updated 更新日期 文件更新日期 comments 开启文章的评论功能 true tags 标签(不适用于分页) categories 分类(不适用于分页) permalink 覆盖文章网址 感谢支持 昵称 支持方式 数目 备注信息 null 微信 10 持续等更新中。。 阿胜 支付宝 2.33 啊哈哈有博客了 Peng( ‘◕¸◕’ ). 支付宝 1 多谢 浮游([email protected]) QQ群红包 5 真的是,完全小白一个,多亏了博主的文章 ぉ绝伦ゞ独舞 QQ群红包 4 到时候有问题 请帮忙 胡鬧、是一種依賴 支付宝 5 棒棒哒~ null 微信 5 多谢,等更 追 支付宝 6.66 666666 Me’鮟 支付宝 10 低调的ヾ提莫 支付宝 2 Neil 友情链接 * https://zhuanlan.zhihu.com/p/48511707 *航 微信 5 非常感谢您的博客 #23. QQ群红包 11.1 清与时光 友情链接 * http://www.pilotluobo.top/ Lixu 友情链接 * http://www.lixu.fun/2018/11/15/hexo-gihub/ 很感谢,持续更新中。。。]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Typora tutorial(English edition)]]></title>
<url>%2F2018%2F09%2F30%2FTypora-tutorial-English-edition%2F</url>
<content type="text"><![CDATA[Markdown For TyporaOverviewMarkdown is created by Daring Fireball, the original guideline is here. Its syntax, however, varies between different parsers or editors. Typora is using GitHub Flavored Markdown. Outline [TOC] Block ElementsParagraph and line breaksA paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by more than one blank lines. In Typora, you only need to press Return to create a new paragraph. Press Shift + Return to create a single line break. However, most markdown parser will ignore single line break, to make other markdown parsers recognize your line break, you can leave two whitespace at the end of the line, or insert <br/>. HeadersHeaders use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example: 12345# This is an H1## This is an H2###### This is an H6 In typora, input ‘#’s followed by title content, and press Return key will create a header. BlockquotesMarkdown uses email-style > characters for block quoting. They are presented as: 1234567> This is a blockquote with two paragraphs. This is first paragraph.>> This is second pragraph.Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.> This is another blockquote with one paragraph. There is three empty line to seperate two blockquote. In typora, just input ‘>’ followed by quote contents a block quote is generated. Typora will insert proper ‘>’ or line break for you. Block quote inside anther block quote is allowed by adding additional levels of ‘>’. ListsInput * list item 1 will create an un-ordered list, the * symbol can be replace with + or -. Input 1. list item 1 will create an ordered list, their markdown source code is like: 123456789## un-ordered list* Red* Green* Blue## ordered list1. Red2. Green3. Blue Task ListTask lists are lists with items marked as either [ ] or [x] (incomplete or complete). For example: 12345- [ ] a task list item- [ ] list syntax required- [ ] normal **formatting**, @mentions, #1234 refs- [ ] incomplete- [x] completed You can change the complete/incomplete state by click the checkbox before the item. (Fenced) Code BlocksTypora only support fences in Github Flavored Markdown. Original code blocks in markdown is not supported. Using fences is easy: Input ``` and press return. Add an optional language identifier after ``` and we’ll run it through syntax highlighting: 1234567891011121314Here's an example:```function test() { console.log("notice the blank line before this function?");}```syntax highlighting:```rubyrequire 'redcarpet'markdown = Redcarpet.new("Hello World!")puts markdown.to_html``` Math BlocksYou can render LaTeX mathematical expressions using MathJax. Input $$, then press ‘Return’ key will trigger an input field which accept Tex/LaTex source. Following is an example:$$\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}\mathbf{i} & \mathbf{j} & \mathbf{k} \\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \\end{vmatrix}$$ In markdown source file, math block is LaTeX expression wrapped by ‘$$’ mark: 1234567$$\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \\\end{vmatrix}$$ TablesInput | First Header | Second Header | and press return key will create a table with two column. After table is created, focus on that table will pop up a toolbar for table, where you can resize, align, or delete table. You can also use context menu to copy and add/delete column/row. Following descriptions can be skipped, as markdown source code for tables are generated by typora automatically. In markdown source code, they look like: 1234| First Header | Second Header || ------------- | ------------- || Content Cell | Content Cell || Content Cell | Content Cell | You can also include inline Markdown such as links, bold, italics, or strikethrough. Finally, by including colons : within the header row, you can define text to be left-aligned, right-aligned, or center-aligned: 12345| Left-Aligned | Center Aligned | Right Aligned || :------------ |:---------------:| -----:|| col 3 is | some wordy text | $1600 || col 2 is | centered | $12 || zebra stripes | are neat | $1 | A colon on the left-most side indicates a left-aligned column; a colon on the right-most side indicates a right-aligned column; a colon on both sides indicates a center-aligned column. Footnotes123You can create footnotes like this[^footnote].[^footnote]: Here is the *text* of the **footnote**. will produce: You can create footnotes like this[^footnote]. [^footnote]: Here is the text of the footnote. Mouse on the ‘footnote’ superscript to see content of the footnote. Horizontal RulesInput *** or --- on a blank line and press return will draw a horizontal line. YAML Front MatterTypora support YAML Front Matter now. Input --- at the top of the article and then press Enter will introduce one. Or insert one metadata block from the menu. Table of Contents (TOC)Input [toc] then press Return key will create a section for “Table of Contents” extracting all headers from one’s writing, its contents will be updated automatically. Diagrams (Sequence, Flowchart and Mermaid)Typora supports, sequence, flowchart and mermaid, after this feature is enabled from preference panel. See this document for detail. Span ElementsSpan elements will be parsed and rendered right after your typing. Moving cursor in middle of those span elements will expand those elements into markdown source. Following will explain the syntax of those span element. LinksMarkdown supports two style of links: inline and reference. In both styles, the link text is delimited by [square brackets]. To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example: 123This is [an example](http://example.com/ "Title") inline link.[This link](http://example.net/) has no title attribute. will produce: This is an example inline link. (<p>This is <a href="http://example.com/" title="Title">) This link has no title attribute. (<p><a href="http://example.net/">This link</a> has no) Internal LinksYou can set the href to headers, which will create a bookmark that allow you to jump to that section after clicking. For example: Command(on Windows: Ctrl) + Click This link will jump to header Block Elements. To see how to write that, please move cursor or click that link with ⌘ key pressed to expand the element into markdown source. Reference LinksReference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link: 12345This is [an example][id] reference-style link.Then, anywhere in the document, you define your link label like this, on a line by itself:[id]: http://example.com/ "Optional Title Here" In typora, they will be rendered like: This is an example reference-style link. The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write: 1234[Google][]And then define the link:[Google]: http://google.com/ In typora click link will expand it for editing, command+click will open the hyperlink in web browser. URLsTypora allows you to insert urls as links, wrapped by <brackets>. <[email protected]> becomes i@typora.io. Typora will aslo auto link standard URLs. e.g: www.google.com. ImagesImage looks similar with links, but it requires an additional ! char before the start of link. Image syntax looks like this: 123 You are able to use drag & drop to insert image from image file or we browser. And modify the markdown source code by clicking on the image. Relative path will be used if image is in same directory or sub-directory with current editing document when drag & drop. For more tips on images, please read http://support.typora.io//Images/ EmphasisMarkdown treats asterisks (*) and underscores (_) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML <em> tag. E.g: 123*single asterisks*_single underscores_ output: single asterisks single underscores GFM will ignores underscores in words, which is commonly used in code and names, like this: wow_great_stuff do_this_and_do_that_and_another_thing. To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it: 1\*this text is surrounded by literal asterisks\* Typora recommends to use * symbol. Strongdouble *’s or _’s will be wrapped with an HTML <strong> tag, e.g: 123**double asterisks**__double underscores__ output: double asterisks double underscores Typora recommends to use ** symbol. CodeTo indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example: 1Use the `printf()` function. will produce: Use the printf() function. StrikethroughGFM adds syntax to create strikethrough text, which is missing from standard Markdown. ~~Mistaken text.~~ becomes Mistaken text. UnderlineUnderline is powered by raw HTML. <u>Underline</u> becomes Underline. Emoji :smile:Input emoji with syntax :smile:. User can trigger auto-complete suggestions for emoji by pressing ESC key, or trigger it automatically after enable it on preference panel. Also, input UTF8 emoji char directly from Edit -> Emoji & Symbols from menu bar is also supported. Inline MathTo use this feature, first, please enable it in Preference Panel -> Markdown Tab. Then use $ to wrap TeX command, for example: $\lim_{x \to \infty} \exp(-x) = 0$ will be rendered as LaTeX command. To trigger inline preview for inline math: input “$”, then press ESC key, then input TeX command, a preview tooltip will be visible like below: SubscriptTo use this feature, first, please enable it in Preference Panel -> Markdown Tab. Then use ~ to wrap subscript content, for example: H~2~O, X~long\ text~/ SuperscriptTo use this feature, first, please enable it in Preference Panel -> Markdown Tab. Then use ^ to wrap superscript content, for example: X^2^. HighlightTo use this feature, first, please enable it in Preference Panel -> Markdown Tab. Then use == to wrap higglighted content, for example: ==highlight==. HTMLYou could use HTML to style content what pure Markdown does not support, for example, use <span style="color:red">this text is red</span> to add text with red color. Embed ContentsSome websites provide iframe-based embed code which you could also paste into Typora, for example: 1<iframe height='265' scrolling='no' title='Fancy Animated SVG Menu' src='http://codepen.io/jeangontijo/embed/OxVywj/?height=265&theme-id=0&default-tab=css,result&embed-version=2' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'></iframe> VideoYou could use the <video> HTML tag to embed videos, for example: 1<video src="xxx.mp4" /> Other HTML SupportYou could find details here. @ thanks to typora.]]></content>
<categories>
<category>hexo</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hello World]]></title>
<url>%2F2018%2F09%2F24%2Fhello-world%2F</url>
<content type="text"><![CDATA[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 StartCreate a new post1$ hexo new "My New Post" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generate More info: Generating Deploy to remote sites1$ hexo deploy More info: Deployment]]></content>
</entry>
</search>