If you want to have a small site of your own, hexo will help you. Hexo is a fast, concise and efficient blogging framework that supports MarkDown and is easy to deploy.

Hexo website

hexo.io/zh-cn/

And similarly

Hugo: Static web site generator implemented by the Go language

gohugo.io/

Vuepress: VUUe-powered static web site generator

vuepress.vuejs.org/zh/

WordPress and so on.

The preparatory work

  • A Github account (Gitee also works)
  • You should be familiar with the basic commands of Node.js and NPM.

More to the point, brew is recommended for installing all kinds of software if you have A macOS and it’s easy to manage, but if you haven’t used brew before it’s time to check it out (Homebrew website). One more thing Homebrew was written by the same guy who was rejected for an interview at Google because he couldn’t write an inverted binary tree.

My local Node version is as follows:

$ node -v
v11.6.0
$ npm -v
6.5.0
Copy the code

Install hexo

npm install -g hexo-cli 
Copy the code

Initialize the

hexo init jiudian
Copy the code

preview

Access the Jiudian directory and it is now possible to run locally. Execute the following command

hexo s
Copy the code

After running, visit http://localhost:4000 (default port 4000) and you can see hexo’s default landscape theme.

Yml is an important file. The basic configuration is here, such as theme Settings, site titles, etc. Under the Themes folder are themes. Source is the content of the article.

.├ ──.config.yML ├── db.json ├── Packagesource├ ─ ─ themes └ ─ ─ yarn. The lockCopy the code

The default theme is a bit ugly, let’s see how to change the theme. Search hexo-theme on the official website or github to find a theme you like. For example, I use github.com/iissnan/hex… . Then run the git clone command in your site directory (jiudian) to clone the theme to the themes folder.

git clone https://github.com/iissnan/hexo-theme-next.git themes/next
Copy the code

After that, change the theme: landscape property of _config.yml to theme: Next. Then re-execute the Hexo S to see the effect.

Making the deployment of

How do you push it to Github and make it accessible to everyone?

Create a new repository on Github. Note that free users must create a public Repository or they will not be able to access it. The name of the repository is your Github username. Github. IO. Next we install the hexo-deployer-git plug-in. Hexo-deployer-git helps us push hexo-generated pages to Github by executing the following command.

npm install hexo-deployer-git --save
Copy the code

After installation, configure _config.yml as follows:

deploy:
  type: git
  repo: https://github.com/77Y/77Y.github.io.git
  branch: master
Copy the code

And then do it in sequence

hexo g
hexo d
Copy the code

Once you’re done, access your github username.github. IO to see your site.

Published articles

How does Hexo New use Hexo to own a siteCopy the code

Execute the above command to publish an article. When done, perform hexo S to see the effect

If you want to publish to Github, you need to execute hexo D again

Hexo common command

$ hexo n "Article Title"(hexo new"Article Title"Create $hexo G (hexo generate) Generate $hexo S (Hexo Server) preview $hexo D (hexo deploy) deployCopy the code

Configuration of the domain name

  • Create a CNAME file in the source directory of the project created by Hexo and fill it with your own domain name.

  • Open github project setting, add Custom Domain and select Enforce HTTPS. HTTPS will be supported.

  • In the domain name resolution (here is ali Cloud console) for the following Settings

That’s it. Welcome to Democome.com

To learn more, please pay attention to the official number: nine o ‘clock off work