title: 个人博客
categories: 博客
tags:
基于Nexmoe的搭建的个人博客
https://nodejs.org/download/release/v10.15.3/ 安装node
npm install -g cnpm --registry=https://registry.npm.taobao.org 安装cnpm
npm config set registry https://registry.npm.taobao.org 使用npm淘宝源
npm install -g hexo-cli
hexo init blog
cd blog
npm install
cd themes
git clone https://github.com/nexmoe/hexo-theme-nexmoe.git nexmoe
cd nexmoe
git checkout master
npm i --save hexo-wordcount
npm i hexo-deployer-git --save
npm i -g gulp --save
cp -i _config.example.yml _config.yml
vim package.json
"scripts": {
"build": "hexo clean && hexo g && gulp && hexo d & git add * & git commit -m '加油' & git push origin master",
"test": "hexo clean && hexo g && gulp && hexo s",
"dev": "hexo clean && hexo g && hexo s"
},
默认自动开启github pages
[外链图片转存失败(img-nGO4Ms9C-1566442013035)(https://www.github.com/OneJane/blog/raw/master/小书匠/1566209438050.png)]
npm install gulp
npm install --save-dev gulp
npm install gulp-htmlclean gulp-htmlmin gulp-minify-css gulp-uglify gulp-imagemin --save
gulpfile.js
var 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');
// 压缩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'))
});
// 压缩css
gulp.task('minify-css', function() {
return gulp.src('./public/**/*.css')
.pipe(minifycss({
compatibility: 'ie8'
}))
.pipe(gulp.dest('./public'));
});
// 压缩js
gulp.task('minify-js', function() {
return gulp.src('./public/js/**/*.js')
.pipe(uglify())
.pipe(gulp.dest('./public'));
});
// 压缩图片
gulp.task('minify-images', function() {
return gulp.src('./public/images/**/*.*')
.pipe(imagemin(
[imagemin.gifsicle({'optimizationLevel': 3}),
imagemin.jpegtran({'progressive': true}),
imagemin.optipng({'optimizationLevel': 7}),
imagemin.svgo()],
{'verbose': true}))
.pipe(gulp.dest('./public/images'))
});
// 默认任务
gulp.task('default', [
'minify-html','minify-css','minify-js','minify-images'
]);
hexo g && gulp
title: OneJane
subtitle: 码农养成记
description:
keywords: Spring Cloud,Docker,Dubbo
author: OneJane
language: zh-CN
timezone: Hongkong
url: https://onejane.github.io/
theme: nexmoe
deploy:
type: git
repo:
github: [email protected]:OneJane/OneJane.github.io.git
branch: master
message: github
highlight:
enable: false
line_number: true
auto_detect: false
tab_replace:
avatar: https://i.loli.net/2019/08/20/UIhTqdQiPasxLtr.jpg # 网站 Logo
background: https://i.loli.net/2019/01/13/5c3aec85a4343.jpg # 既是博客的背景,又是文章默认头图
favicon:
href: /img/a.ico # 网站图标
type: image/png # 图标类型,可能的值有(image/png, image/vnd.microsoft.icon, image/x-icon, image/gif)
social:
zhihu:
- https://www.zhihu.com/people/codewj/activities
- icon-zhihu
- rgb(231, 106, 141)
- rgba(231, 106, 141, .15)
GitHub:
- https://github.com/OneJane
- icon-github
- rgb(25, 23, 23)
- rgba(25, 23, 23, .15)
analytics:
la_site_id: 20279757
comment: gitment
gitment:
owner: onejane # 持有该 repo 的 GitHub username
repo: onejane.github.io # 存放评论的 issue 所在的 repo
clientID: e677e59382e1c7a468fd # GitHub Client ID
clientSecret: 717d041bc4ab749f069314862232cfb6ec8adc15 # GitHub Client Secret
themes/nexmoe/layout/_partial/donate.ejs
themes/nexmoe/source/css/_partial/donate.styl
.donate_bar {
text-align: center;
margin-top: 5%
}
.donate_bar a.btn_donate {
display: inline-block;
width: 82px;
height: 82px;
margin-left: auto;
margin-right: auto;
background: url(http://img.t.sinajs.cn/t5/style/images/apps_PRF/e_media/btn_reward.gif)no-repeat;
-webkit-transition: background 0s;
-moz-transition: background 0s;
-o-transition: background 0s;
-ms-transition: background 0s;
transition: background 0s
}
.donate_bar a.btn_donate:hover {
background-position: 0 -82px
}
.donate_bar .donate_txt {
display: block;
color: #9d9d9d;
font: 14px/2 "Microsoft Yahei"
}
.donate_bar.hidden{
display: none
}
.post-donate{
margin-top: 80px;
}
#donate_guide{
height: 210px;
width: 420px;
margin: 0 auto;
}
#donate_guide img{
height: 200px;
height: 200px;
}
在source\css\style.styl中添加@import ‘_partial/donate’
themes/nexmoe/layout/post.ejs
<% if (theme.donate){ %>
<%- partial('donate') %>
<% } %>
themes/nexmoe/_config.yml
#是否开启打赏功能
donate: true
#打赏文案
donate_message: 欣赏此文?求鼓励,求支持!
hexo new page 404 生成source/404.md
---
title: 404
permalink: /404
cover: https://i.loli.net/2019/08/20/DMuWHOGTq4AR1iQ.png
---
themes/nexmoe/layout/layout.ejs
...
[外链图片转存失败(img-2NYPbKl3-1566442013036)(https://www.github.com/OneJane/blog/raw/master/小书匠/1566289523679.png)]
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\copypath]
@="copy path of dir"
[HKEY_CLASSES_ROOT\Directory\shell\copypath\command]
@="mshta vbscript:clipboarddata.setdata(\"text\",\"%1\")(close)"
[HKEY_CLASSES_ROOT\*\shell\copypath]
@="copy path of file"
[HKEY_CLASSES_ROOT\*\shell\copypath\command]
@="mshta vbscript:clipboarddata.setdata(\"text\",\"%1\")(close)"
此电脑–>管理–>任务计划管理–>任务计划程序 -->任务计划程序库–>Microsoft -->windows
[外链图片转存失败(img-ToK1hQKG-1566442013038)(https://www.github.com/OneJane/blog/raw/master/小书匠/1566295085653.png)]
[外链图片转存失败(img-AJ8HrYnt-1566442013038)(https://www.github.com/OneJane/blog/raw/master/小书匠/1566295124810.png)]
[外链图片转存失败(img-v0K6gURr-1566442013039)(https://www.github.com/OneJane/blog/raw/master/小书匠/1566295158593.png)]
[外链图片转存失败(img-UHvUp2OH-1566442013039)(https://www.github.com/OneJane/blog/raw/master/小书匠/1566295176914.png)]
vim C:\Users\codewj\Desktop\build-blog.bat
E: && cd E:\Project\blog && npm run build
https://www.bing.com/toolbox/webmaster/ 登陆后进入https://www.bing.com/webmaster/home/mysites#
[外链图片转存失败(img-qjUXaPyQ-1566443800082)(https://www.github.com/OneJane/blog/raw/master/小书匠/1566443375134.png)]
https://www.bing.com/webmaster/home/dashboard?url=https%3A%2F%2Fonejane.github.io%2F
小书匠
[外链图片转存失败(img-zQZYpc1L-1566464243671)(https://www.github.com/OneJane/blog/raw/master/小书匠/1566464145217.png)]
[外链图片转存失败(img-QeSwfna2-1566464243672)(https://www.github.com/OneJane/blog/raw/master/小书匠/1566464192463.png)]
"devDependencies": {
"gulp": "^3.9.1"
}
npm install
npm install gulp-util --save-dev
var gutil = require('gulp-util');
// 压缩public目录下的所有js
gulp.task('minify-js', function() {
return gulp.src('./public/**/*.js')
.pipe(uglify())
.on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); }) //增加这一行
.pipe(gulp.dest('./public'));
});
gitalk.ejs id: window.location.pathname改为id: decodeURI(window.location.pathname)