hexo zero-based build blog series (a)


For other structures

hexo4 quickly build blog (ii) change the theme


hexo4 quickly build blog (c) to collect a lot of information very comprehensive beautification


hexo4 quickly build blog (d) contains map bed and writing skills automatically flips bed plugin


hexo4 build a blog series (five) optimization blog (no pit) deployed to the cloud Ali


hexo4 build a blog series (six) Baidu, Bing, Google included (no pit)

Build a blog is not difficult, but a lot of online information pit. I may be some mistake, please indicate in the comments. But there are tested.
I use the version hexo4.0 + NexT7.6 version.


My personal blog

There Ali cloud server can be deployed up, no github can also be used to store, it is free on github, but access is slower.

What I do not understand despite the harassment, I can notice. So that problems can be resolved quickly
1. Introduction

There are many online tutorials hexo + nexT7, a lot of problems because the version now, some configuration error or done will not take effect. Build this blog took me four days, plus landscaping.
Used during nexT5.0 and hexo4.0 access path leading to a little problem, http appear: // localhost: 4000 / archives / 20% / I do not understand Editor's Note, the puncturing two local blog. It was found that a version of the problem.

First, make it clear at the front, give me every step done using a local test three instructions (below say) it, do not do silly waiting for the completion of half or even all done only to test if an error that's very deadly, of course, the worst result is redone. If the bug occurs each time the test if the problem can be ruled out, depending on which step.

And I use the latter was to carry out his Ali cloud server, the other servers not touched, but roughly the same. Want to get behind the domain name you can now go to get a domain name, such as cloud Ali million net (I was in this really), cloud Tencent, Baidu cloud and so can. And go for the record. Of course, also can not prepare, CDN acceleration is required before they can apply for the record. After the first case was prepared by Ye Hao work.


2. Install Node and Git

Use hexo need to install the two front tools: Node and Git.

Node directly installed by default on the line, click on the download [Node] (http://nodejs.cn/download/). Installing without reason.

Git also a direct download, click the Download [Git] (https://git-scm.com/). The default installation has been completed requires the following:

If you do not GitHub account, to register themselves with the account directly create a new repository called yourgithubname.github.io, which yourgithubname your github name, you must operate.
For example, I: / in front of my username, behind is to use my username.

- Configure Git's SSH Key, the first use Git Bash uses some configurations:
- your github username, non nickname, and fill in your registered email github

git config --global user.name "name"
git config --global user.email "[email protected]"

- Configure SSH, you can log in their own, do not log on each deployment

ssh-keygen -t rsa -C "mail address"


- then 3 consecutive carriage return, will eventually generate a file in the user directory, open the user directory of the C drive your username continue to open, find .ssh \ id_rsa.pub file (like my C: \ Users \ chast \ .ssh), open Notepad and copy the contents inside, open your github page, upper right corner of your little head into the Settings -> SSH and GPG keys - > New SSH key: Title casually named, copy and paste the contents of Key to the middle.


3. Install HEXO
- then open git just installed, there will be a Git Bash at the beginning Window interface, click it, and then create a directory on a disk above, casually name, then use the Git Bash navigate to the directory



- then install Hexo: version 4.0 installed by default.

npm install -g hexo


- initialization Hexo.

hexo init

- initialization as follows.

- After you use the following three instructions in a local startup blog for testing.

hexo clean // clear the cache 
hexo g // generate static pages 
hexo s // start local projects

 


- then you can visit in the browser [localhost: 4000] (localhost: 4000) to see the original blog, if you see the shows a success.

- then deploy blog to git, _config.yml first file in the directory of the site last line configuration.

deploy:
type: git
repository: https://github.com/yourgitname/yourgitname.github.io.git
branch: master


- Push install plugin

npm install hexo-deployer-git --save

 

- Then use the following three commands.

hexo clean // 清除缓存
hexo g // 生成静态页面
hexo d // 部署

 

4.Hexo的目录结构


- 如果想自定义修改站点主题的内容在:站点目录\themes\next\layout中修改,根据文件名。
- 如果想自己添加css样式,在主题配置文件中把下图的注释去掉,然后去对应的目录创建该文件,然后就在里面添加css样式。

5.我的版本
如何查看我的版本,在站点根目录下(hexo初始化的地方)有一个 ==packge.json== ,里面就可以看到使用hexo初始化的结果。

主要注意跟我的hexo和等下要装的主题nexT是否一致,最好一致,可以在初始化后拿我下面的代码去覆盖原代码,然后使用 ==npm install== ,会根据json中的代码重新安装一样的版本。**不过建议别copy我的去安装,不知道会报什么错,还是一步一步来。版本的一致用于后面的美化主题是否能生效有关系。**

{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"hexo": {
"version": "4.0.0"
},
"dependencies": {
"gulp": "^4.0.2",
"gulp-clean": "^0.4.0",
"gulp-htmlclean": "^2.7.22",
"gulp-htmlmin": "^5.0.1",
"gulp-imagemin": "^6.2.0",
"gulp-minify-css": "^1.2.4",
"gulp-uglify": "^3.0.2",
"hexo": "^4.0.0",
"hexo-abbrlink": "^2.0.5",
"hexo-asset-image": "^1.0.0",
"hexo-autonofollow": "^1.0.1",
"hexo-baidu-url-submit": "0.0.6",
"hexo-deployer-git": "^2.1.0",
"hexo-generator-archive": "^1.0.0",
"hexo-generator-baidu-sitemap": "^0.1.6",
"hexo-generator-category": "^1.0.0",
"hexo-generator-feed": "^2.2.0",
"hexo-generator-index": "^1.0.0",
"hexo-generator-search": "^2.4.0",
"hexo-generator-searchdb": "^1.2.0",
"hexo-generator-sitemap": "^2.0.0",
"hexo-generator-tag": "^1.0.0",
"hexo-neat": "^1.0.4",
"hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^2.0.0",
"hexo-renderer-stylus": "^1.1.0",
"hexo-server": "^1.0.0",
"hexo-symbols-count-time": "^0.7.0",
"hexo-wordcount": "^6.0.1"
},
"devDependencies": {}
}

喜欢的记得点个赞
还有后续搭建博客:
[hexo4-NexT7搭建博客(二)更换主题](https://blog.csdn.net/weixin_41800884/article/details/103750634)

Guess you like

Origin www.cnblogs.com/flunggg/p/12127166.html