记录小白如何0成本0基础0难度搭建一个hexo博客全过程[三0小白养成]
前言:谁没想过做一个自己的网站,装装逼。
看那昂贵地服务器和复杂地过程不禁让人望而止步
然鹅,有很多网站是提供静态网站托管的
除了众所周知地github coding gitee
还有一个 我曾用过的台湾网站drv.tw
支持OneDrive 和 Google drive
速度比GitHub pages还是快不少的
1.准备工具——预先善其事,必先利其器
- git
- node.js
- 手和眼睛
- github账号(可选,部署到github pages)
2.安装工具
git官方网址:https://git-scm.com/
node.js中文官方:https://nodejs.org/zh-cn/
相信安装大家都会的,但是毕竟0基础,百度大法好(个屁)
git安装教程来自百度第二个:https://www.cnblogs.com/xueweisuoyong/p/11914045.html
nodejs安装教程来自百度第一个:https://www.jianshu.com/p/13f45e24b1de
我就不做说说明了
nodejs安装库有一点需要说明
淘宝提供了npm的镜像叫做cnpm 装库更爽哦
在cmd执行一下命令
npm install cnpm -g --registry=https://registry.npm.taobao.org
cnpm -v 若出现版本号则安装成功
小结:
1.右键出现
证明git安装成功
2.依次输入如图命令
均出现版本号则安装成功
附命令
npm -v
node -v
cnpm -v
环境搭建就此告一段落
三.进入主题,安装hexo
然后我就遇到了我搭建过程中最大的深坑
我遇到了一个交代不清的教程
始终提示我不是empty folder
然后zz百度告诉我rm rf /* !
也有道理,但我在桌面执行的命令!
1.新建一个空文件夹(就是这个!)
2.右键,选择git bath here
3.该装库了,原本时npm的很慢,上文我们已经装了cnpm
命令如下
cnpm install hexo-cli -g
cnpm install hexo-cli -g
Downloading hexo-cli to C:\Users\niubi\AppData\Roaming\npm\node_modules\hexo-cli_tmp
Copying C:\Users\niubi\AppData\Roaming\npm\node_modules\hexo-cli_tmp\_hexo-cli@3.1.0@hexo-cli to C:\Users\niubi\AppData\Roaming\npm\node_modules\hexo-cli
Installing hexo-cli's dependencies to C:\Users\niubi\AppData\Roaming\npm\node_modules\hexo-cli/node_modules
[1/11] abbrev@^1.1.1 installed at node_modules\_abbrev@1.1.1@abbrev
[2/11] minimist@^1.2.0 installed at node_modules\_minimist@1.2.5@minimist
[3/11] command-exists@^1.2.8 installed at node_modules\_command-exists@1.2.9@command-exists
[4/11] bluebird@^3.5.5 installed at node_modules\_bluebird@3.7.2@bluebird
[5/11] acorn@^7.0.0 installed at node_modules\_acorn@7.2.0@acorn
[6/11] tildify@^2.0.0 installed at node_modules\_tildify@2.0.0@tildify
platform unsupported hexo-fs@2.0.1 › chokidar@3.4.0 › fsevents@~2.1.2 Package require os(darwin) not compatible with your platform(win32)
[fsevents@~2.1.2] optional install error: Package require os(darwin) not compatible with your platform(win32)
[7/11] resolve@^1.11.0 installed at node_modules\_resolve@1.17.0@resolve
[8/11] chalk@^2.4.2 installed at node_modules\_chalk@2.4.2@chalk
[9/11] hexo-fs@^2.0.0 installed at node_modules\_hexo-fs@2.0.1@hexo-fs
[10/11] hexo-util@^1.4.0 installed at node_modules\_hexo-util@1.9.1@hexo-util
[11/11] hexo-log@^1.0.0 installed at node_modules\_hexo-log@1.0.0@hexo-log
Recently updated (since 2020-05-08): 6 packages (detail see file C:\Users\niubi\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\.recently_updates.txt)
2020-05-14
→ hexo-util@1.9.1 › camel-case@4.1.1 › tslib@^1.10.0(1.13.0) (06:56:03)
2020-05-13
→ hexo-fs@^2.0.0(2.0.1) (23:08:22)
→ hexo-util@^1.4.0(1.9.1) (21:00:07)
2020-05-10
→ hexo-util@1.9.1 › htmlparser2@4.1.0 › domutils@^2.0.0(2.1.0) (03:27:48)
→ hexo-util@1.9.1 › htmlparser2@4.1.0 › entities@^2.0.0(2.0.2) (06:04:37)
2020-05-09
→ acorn@^7.0.0(7.2.0) (15:04:41)
All packages installed (81 packages installed from npm registry, used 5s(network 5s), speed 512.36kB/s, json 80(172.22kB), tarball 2.37MB)
[hexo-cli@3.1.0] link C:\Users\niubi\AppData\Roaming\npm\hexo@ -> C:\Users\niubi\AppData\Roaming\npm\node_modules\hexo-cli\bin\hexo
安装成功
4.输入hexo init
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
Cloning into 'F:\jilu'...
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (30/30), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 161 (delta 12), reused 12 (delta 4), pack-reused 131
Receiving objects: 100% (161/161), 31.79 KiB | 153.00 KiB/s, done.
Resolving deltas: 100% (74/74), done.
Submodule 'themes/landscape' (https://github.com/hexojs/hexo-theme-landscape.git) registered for path 'themes/landscape'
Cloning into 'F:/jilu/themes/landscape'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 1067 (delta 0), reused 0 (delta 0), pack-reused 1063
Receiving objects: 100% (1067/1067), 3.22 MiB | 325.00 KiB/s, done.
Resolving deltas: 100% (585/585), done.
Submodule path 'themes/landscape': checked out '73a23c51f8487cfcd7c6deec96ccc7543960d350'
INFO Install dependencies
yarn install v1.22.4
info No lockfile found.
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
warning hexo-renderer-stylus > stylus > css-parse > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning hexo-renderer-stylus > stylus > css-parse > css > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning hexo-renderer-stylus > stylus > css-parse > css > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
[2/4] Fetching packages...
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 150.69s.
INFO Start blogging with Hexo!
我的网很不好,然鹅第一次使用会让你输入npm istall
我们输入cnpm install 就可以了
5.输入hexo g
注:此处的g为缩写generate
后文s也为sever的缩写均能正常识别
出来一大堆,我就不水了,不发出来了
6.输入hexo s
Hexo is running at http://localhost:4000
出现这个就证明你的html生成成功了
打开它吧!
乍一看好像海星,但是你你想想怎么可能一个博客的主页怎么可能一篇文章就占领整个页面
没有一篇文章提及过,还好群里有大佬
1.打开 博客所在目录\source\_posts
2.看到了hello-world.md
3.使用合适的编辑器打开,首推Typora
4.在你想要截取的内容后面加入
<!--more-->
5.重复上述hexo g 和 hexo s
6.可见正常多了
7.本地操作到此截至网页已经生成
8.你的博客目录\public
public放到支持托管的网站便能使用了
4.更改主题
郑重推荐只是用NexT主题,因为别的主题配置太太太太太麻烦了根本没有一丝教程
http://theme-next.iissnan.com/官网
官方的教程很详尽了我就无需介绍了
http://theme-next.iissnan.com/getting-started.html