Verbatim https://www.dazhuanlan.com/2019/08/25/5d625ae568844/
Specific installation methods google own friends ~
start using
Installation yarn
In the cmd
next input
1 |
npm install -g yarn |
-g
Represents the global install the plug-in added to the system environment variables manipulation cmd
can be used in any directory yarn
command
Installation Hexo
1 |
$ yarn add hexo |
Initialization Hexo
Hexo after installation is complete, execute the following command, Hexo new document will specify the desired folder on your document.
1 |
hexo init <folder> |
After finished, your project will generate the following directory structure
1 |
. |
Here you have completed all of the preparatory work, only one command to start your blog
Local preview Hexo
In turn enter the next project directory
1 |
HEXO Cl |
After a successful, visit http: // localhost: 4000 / start your preview
If the port is occupied want to customize a new port or want to start Debug mode again how to do?
hexo s start command has additional parameters
-p [port number] modify the port number
-debug debug mode is turned on
1 |
HEXO S -P [port number] --debug |
Deployment Hexo
We write more blog or want to share with the local self-hey how can do it, it must be deployed to the server you ~ There are two ways you can deploy our blog
Open GitHub , to create a new Repository
Repository name must to [your user name] .github.io
your local public key bindings on github, if not already generated public key ssh, execute the following command to generate a new public key :
1 |
ssh-keygen |
If the Windows operating system,
this time will be in C: Documents id_rsa generate the key and public key documents id_rsa.pub under UsersUsername.ssh directory.
Click on the upper right corner on github picture settings / SSH and GPG keys,
create a new SSH key, you will copy the contents of id_rsa.pub to key in the document
Set in the site configuration file in _config.yml
1 |
# Deployment |
安装Hexo部署插件
1 |
yarn add hexo-deployer-git |
在当前目录下打开 cmd输入以下命令 开始部署
1 |
hexo cl |
访问 [你的github项目名].github.io 查看是否部署成功
每次启动或者部署输入三个命令很麻烦,可以把这三个命令写入到 package.json
中
1 |
"scripts": { |
After just type yarn start
(start Preview) yarn deploy
(deployment)
VPS deployment
Think about it
Untied opened