[Hexo][02] - The creation of this website

This is the log of the creation of this website. You may read as a tutorial.


After create and run the starting page, we need to add theme and post.

Adding a themes to your website

The first thing is to find a theme that you wish to apply to your website.
You can find many themes on here https://hexo.io/themes/index.html .

After you find the theme, you click the theme name to get in the theme github page like this.
this is the theme of this blog


All code here will use this theme as example, if you are using a different theme, plz change the code to fit your theme.

Clone the theme to your local file.

Go back to VScode terminal, your web file directory and clone the theme by this code.

1
git clone git://github.com/Molunerfinn/hexo-theme-melody.git themes/melody

Change your web theme.

Then go to file [yourweb]\_config.yml fine theme: at the last and change it to your theme.

1
theme: melody

And preview in localhost by this 3 command.

1
hexo clean
1
hexo g
1
hexo s

And also hexo d to deploy, and back up 3 step :git add ., git commit -m "typesomething", and git push origin hexo.




Adding page to your website.

Here is how to add some defult page of the theme. (If your theme has provided these pages.)

For the tags page:

1
hexo new page "tags"

Then a new directory tags should be created and it have a file call index.md.
Open the index.md file, and add a type become like this.

1
2
3
4
5
 ---
title: tags
date: 2019-10-08 05:48:26
type: "tags"
---

categories page will be same procedure.

1
hexo new page "categories"

Then a new directory categories should be created and it have a file call index.md.
Open the index.md file, and add a type become like this.

1
2
3
4
5
 ---
title: categories
date: 2019-10-08 05:48:26
type: "categories"
---

You can add more pages you want by the same step.

Add the page to the menu.

Go to the _config.yml under your theme directory. NOT your website file.

[youwebfile]\themes\melody\_config.yml and add your page like this.

1
2
3
4
5
6
menu:
Home: /
Archives: /archives
Tags: /tags
Categories: /categories
#XXX: /xxx



Adding post to your website.

Finally add some real content to the website. Here is how to add post.
Type the following code, and fill in the file name of you post.

1
hexo new [filename]

And you can add some tags and categories to your post like this.

1
2
3
4
5
6
7
8
9
---
title: "[Hexo][01] - The creation of this website"
date: 2019-10-08 18:23:34
tags: [tutorial,log,hexo,SSH,web]
categories:
- [porject-log]
- [tutorial]
- [hexo]
---

Another example:

1
2
3
4
5
6
7
8
9
---
title: "[Hexo][02] - The creation of this website"
date: 2019-10-10 03:49:51
tags: [tutorial,log,hexo,web]
categories:
- [porject-log]
- [tutorial]
- [hexo]
---
Author: williamlun
Link: williamlun.github.io/2019/10/10/Log-hexo-2/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.