博客搭建

篇幅有限

完整内容及源码关注公众号:ReverseCode,发送

Hexo

1
2
3
4
5
6
7
8
https://nodejs.org/download/release/v10.15.3/ 安装node
npm install -g cnpm --registry=https://registry.npm.taobao.org
npm config set registry https://registry.npm.taobao.org
npm install -g hexo@4.1.1
npm install -g hexo-cli@1.3.0
hexo init blog
cd blog
npm install

Melody

1
2
3
4
5
6
7
8
9
10
11
12
13
set http_proxy=http://127.0.0.1:1080
set https_proxy=https://127.0.0.1:1080
git clone -b master https://github.com/Molunerfinn/hexo-theme-melody themes/melody
npm install hexo-renderer-pug hexo-renderer-stylus
cp themes\melody\_config.yml themes\melody\melody.yml 通过git pull 即可更新melody
npm i --save hexo-wordcount
npm i hexo-deployer-git --save

使用git bash
npm install --save-dev gulp@3.9.1
npm install -g gulp@3.9.1
npm install gulp-imagemin@3.1.1 --save
npm install gulp-htmlclean gulp-htmlmin gulp-minify-css gulp-uglify --save

blog\package.json

1
2
3
4
5
"scripts": {
"build": "hexo clean && hexo g && gulp && hexo d & git add * & git commit -m 'deploy' & git push origin master",
"test": "hexo clean && hexo g && gulp && hexo s",
"dev": "hexo clean && hexo g && hexo s"
}

通过npm run build 即可自动打包上传发布http://onejane.gitee.io/

新建Onajane公开项目,hexo d后启用服务的Gitee Pages

gitee_page

新建picture公开项目,上传图片后启动服务的Gitee Pages图床服务,http://onejane.gitee.io/picture/avatar.jpg

blog_config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
title: J
subtitle: '朝花夕拾'
description: '逆向,爬虫'
keywords:
author: J
language: zh-Hans
timezone: 'Hongkong'
url: https://gitee.com/OneJane
theme: melody
post_asset_folder: true # npm install https://github.com/CodeFalling/hexo-asset-image --save 上传图片到博客
deploy:
type: git
repo:
gitee: https://gitee.com/OneJane/OneJane.git
github: git@github.com:OneJane/OneJane.github.io.git
branch: master
message: gitee

评论

https://leancloud.cn/dashboard/applist.html#/apps 新建应用获取AppID,AppKey

1
2
3
4
5
6
7
8
9
10
11
12
valine:
enable: true # if you want use valine,please set this value is true
appId: cWLsquGr5PNi33OWXNhzerep-gzGzoHsz # leancloud application app id
appKey: S35phfCSbm8dAG9LpOc5rjm3 # leancloud application app key
notify: false # valine mail notify (true/false) https://github.com/xCss/Valine/wiki
verify: false # valine verify code (true/false)
recordip: false # whether record commentor's ip (true/false)
pageSize: 10 # comment list page size
avatar: mm # gravatar style https://valine.js.org/#/avatar
lang: zh-cn # i18n: zh-cn/en
placeholder: 一起来吹牛逼好吗! # valine comment input placeholder(like: Please leave your footprints )
guest_info: nick,mail,link #valine comment header inf

分享

1
2
3
sharejs:
enable: true
disabled_sites: google,facebook

搜索

本地 npm install hexo-generator-search –save

1
2
3
4
5
local_search:
enable: true # or false
labels:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result

头像

1
avatar: http://onejane.gitee.io/picture/avatar.jpg # 网站 Logo

导航菜单

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
hexo new page tags
修改source/tags/index.md
---
title: 标签
date: 2018-01-05 00:00:00
type: "tags"
---
hexo new page categories
修改source/categories/index.md
---
title: 分类
date: 2018-01-05 00:00:00
type: "categories"
---
修改_config.yml
menu:
主页: /
归档: /archives
标签: /tags
分类: /categories

自动节选

1
2
3
auto_excerpt:
enable: true
length: 150

顶部图

1
2
top_img_height: 80 
top_img: http://onejane.gitee.io/picture/hacker.jpg 在_config.yml和文章中使用

打赏

1
2
3
4
5
6
7
QR_code:
- itemlist:
img: http://onejane.gitee.io/picture/alipay.png
text: 支付宝打赏
- itemlist:
img: http://onejane.gitee.io/picture/wx.png
text: 微信打赏

广告/音乐播放器

1
2
3
adv:
enable: true
info: <iframe frameborder="no" border="0" marginwidth="center" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=572547816&auto=1&height=66"></iframe>

Follow

1
2
3
4
follow:
enable: true
url: 'https://gitee.com/OneJane/'
text: 'Follow Me'

友链

1
2
3
links_title: 友链   # 配置友链的标题文字
links:
OneJane: http://onejane.gitee.io/

目录

1
2
3
4
toc:
enable: true # or false
number: true # or false. 版本v1.5.6新增
在文章头部加入toc_number: true

页脚

1
footer_custom_text: Hi, welcome to my <a href=http://onejane.gitee.io/">blog</a>!

配置成hitokoto则是随机的谚语

点击特效

1
fireworks: true

彩带

1
2
3
4
5
6
canvas_ribbon:
enable: true
size: 150
alpha: 0.6
zIndex: -1
click_to_change: false

阅读密码

npm install –save hexo-blog-encrypt

1
2
3
文中标题填入
password: blogJ
message: 请联系微信:codewj,获取本文密码

分析

baidu

https://tongji.baidu.com/sc-web/10000134724/home/site/index?from=3

新增网站后,获取hm.src = “https://hm.baidu.com/hm.js?***";作为百度id

google

https://analytics.google.com/analytics/web/#/a111479568p260655414/admin

创建媒体资源-显示高级选项-创建 Universal Analytics 媒体资源,创建好后进入媒体资源设置获取跟踪ID,UA开头的就是谷歌id

1
2
baidu_analytics: ***
google_analytics: ***
文章作者: J
文章链接: http://onejane.github.io/2021/01/31/博客搭建/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 万物皆可逆向
支付宝打赏
微信打赏