记录小白如何0成本0基础0难度搭建博客全过程[三0小白养成](一)
本帖最后由 Ldfd 于 2020-5-16 20:22 编辑我的工具人朋友为大家录制了保姆级别的教程,欢迎大家配文辅助食用
https://www.bilibili.com/video/av753240180# 记录小白如何0成本0基础0难度搭建一个hexo博客全过程[三0小白养成]
> 前言:谁没想过做一个自己的网站,装装逼。
>
> 看那昂贵地服务器和复杂地过程不禁让人望而止步
>
> 然鹅,有很多网站是提供静态网站托管的
>
> 除了众所周知地github coding gitee
>
> 还有一个 我曾用过的台湾网站drv.tw
>
> 支持OneDrive 和 Google drive
>
> 速度比GitHub pages还是快不少的
## 1.准备工具——预先善其事,必先利其器
1. git
2. node.js
3. 手和眼睛
4. 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.右键出现![](https://gitee.com/loadingfd/picture/raw/master/img/20200515094337.png)
证明git安装成功
2.依次输入如图命令
![](https://gitee.com/loadingfd/picture/raw/master/img/20200515094622.png)
均出现版本号则安装成功
附命令
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
abbrev@^1.1.1 installed at node_modules\_abbrev@1.1.1@abbrev
minimist@^1.2.0 installed at node_modules\_minimist@1.2.5@minimist
command-exists@^1.2.8 installed at node_modules\_command-exists@1.2.9@command-exists
bluebird@^3.5.5 installed at node_modules\_bluebird@3.7.2@bluebird
acorn@^7.0.0 installed at node_modules\_acorn@7.2.0@acorn
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)
optional install error: Package require os(darwin) not compatible with your platform(win32)
resolve@^1.11.0 installed at node_modules\_resolve@1.17.0@resolve
chalk@^2.4.2 installed at node_modules\_chalk@2.4.2@chalk
hexo-fs@^2.0.0 installed at node_modules\_hexo-fs@2.0.1@hexo-fs
hexo-util@^1.4.0 installed at node_modules\_hexo-util@1.9.1@hexo-util
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)
link C:\Users\niubi\AppData\Roaming\npm\hexo@ -> C:\Users\niubi\AppData\Roaming\npm\node_modules\hexo-cli\bin\hexo
```
安装成功
4.输入hexo init
```
INFOCloning 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'
INFOInstall dependencies
yarn install v1.22.4
info No lockfile found.
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...
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.
Linking dependencies...
Building fresh packages...
success Saved lockfile.
Done in 150.69s.
INFOStart 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生成成功了
打开它吧!
![](https://gitee.com/loadingfd/picture/raw/master/img/20200515105859.png)
乍一看好像海星,但是你你想想怎么可能一个博客的主页怎么可能一篇文章就占领整个页面
**没有一篇文章提及过,还好群里有大佬**
1.打开 博客所在目录\source\\_posts
2.看到了hello-world.md
3.使用合适的编辑器打开,首推Typora
4.在你想要截取的内容后面加入
<!--more-->
5.重复上述hexo g 和 hexo s
6.可见正常多了
![](https://gitee.com/loadingfd/picture/raw/master/img/20200515110551.png)
7.本地操作到此截至网页已经生成
8.你的博客目录\public
public放到支持托管的网站便能使用了
## 4.更改主题
郑重推荐只是用NexT主题,因为别的主题配置太太太太太麻烦了根本没有一丝教程
http://theme-next.iissnan.com/官网
官方的教程很详尽了我就无需介绍了
http://theme-next.iissnan.com/getting-started.html
我的blog在签名放了 大家可以光临光临(我i就是悲催的不用NexT的人)
git和nodejs的蓝奏链接(git下载过慢)https://loadingfd.lanzouj.com/b06fz11od
密码:1vd7
第二篇https://www.52pojie.cn/forum.php?mod=viewthread&tid=1179888&page=1&extra=#pid31941353
dxlydlvv 发表于 2020-5-15 22:33
我觉得搭建博客什么的不难。产出优秀的内容才困难。我cnblog,免费空间,wordpress,甚至用django自己写过 ...
其实没必要那么功利,有时候博客只是自己遗漏的知识点的备份,伴随着技术提高,优秀的内容才可能存在,我们就玩玩罢了 我觉得搭建博客什么的不难。产出优秀的内容才困难。我cnblog,免费空间,wordpress,甚至用django自己写过博客系统。最后的下场就是没有产出优秀的内容,吸引不到用户访问,然后又因为没有人访问而导致没有动力去产生内容,恶性循环,最终没有把博客搞下去。不过在这里还是希望楼主的博客越办越好。 静态博客适合记录一下东西,不适合做“网站”,没有后台。我的签名就是静态博客,托管在coding的
github实在太慢 用宝塔搭建吧 多谢分享 学习哈思路哈 有没有酷炫的源码分享下 最后,在家人的支持下花了 2000 大洋找了个程序员搭建成功! zdnyp 发表于 2020-5-15 10:27
静态博客适合记录一下东西,不适合做“网站”,没有后台。我的签名就是静态博客,托管在coding的
github实 ...
所以我不用github pages 好色仙人请及时更新{:301_1001:} noecyan 发表于 2020-5-15 11:12
好色仙人请及时更新
这些就够做一段时间了,当时我网不好挺费劲。
工口仙人{:301_997:}