This post contains all my personal experience of building this Personal Website, and can be considered as a guide to build your own website as well.
INTRODUCTION
For the best of pushing forward my personal development, a spot for storing personal notes, thoughts and experiences is needed, so I decided to start to build my own Personal Website.
Tool List
Main Tools Used with Reasoning:
- GitHub Pages
- I am lazy to maintain a server.
- Hexo
- Active community with solid looking.
- NexT
- Simply the best choice in Hexo.
If you are advanced enough, you don’t need to read the rest of this article.
GET A WEBSITE
By implement this section, you can get a basic Website powered by Hexo.
Get an Empty Repository
I mean, the official guide is already completed, so here I will only cover some of the details.
Get a GitHub account
Website Link: https://github.com
- Get on GitHub.
- Find and Click “Sign Up”.
- Enter your E-mail and your Password.
- Choose your username (can be changed later).
- Done.
I don’t even know why am I explaining this, but anyway I won’t explain it twice. > That is, if you don’t have an account on any website, just follow the above steps, more or less the same.
Get GitHub Desktop
This step isn’t mandatory, but I strongly recommend you to do so, simply because it is user friendly, much better than dealing with pure terminal, especially if you are new to Git.
Considering your System type:
- Windows
- Just do it.
- Linux
- Arch
- github-desktop
- Install it and it’s done.
- Whenever I say installing it on Arch, it usually means running this
in your terminal
yay -S github-desktop
- Or like this
paru -S github-desktop
- Or maybe like this (they are all the same)
pacman -S github-desktop
- So in general
pacman || paru || yay -S package-name
- Well considering you are using Arch, it shouldn’t be a problem for you to understand this.
- Whenever I say installing it on Arch, it usually means running this
in your terminal
- Install it and it’s done.
- github-desktop
- Other
- I don’t know man, I use Arch.
- Arch
- MacOS
- Switch to Windows.
Get your Repository
By following the official guide, you should get something similar to my repository, but with everything empty.
If it’s not empty, make it empty for following steps. That is, deleting the files in your repository, by clicking files and clicking the red botton, then confirm deleting.
It is not that I don’t want to explain the steps here (or maybe), but it is that things might change, so it’s better to follow the official guide here.
Initializing Hexo
Get Node.js
Nobody cares about Node.js, you don’t need to know about it neither, but we do need it for Hexo.
Considering your System type:
- Windows
- Download and install, even if it warns you there are risks. Safety is for kids.
- Linux
- Arch
- Other
- Don’t care.
Get Git
Similar steps
Get Hexo
Now we have both Node.js and Git, ready for Hexo.
Run this in your terminal:
1 | npm install -g hexo-cli |
“npm” (Node Packaged Modules) is included in Node.js, that’s why we need Node.js. See more. > Though we might not need Git here, but maybe it is for the convenience of following steps. I don’t know.
Done.
Initializing Directory
Steps:
- Prepare a nice directory, where you will deal with all the settings and will edit your posts frequently.
- Open your terminal in that directory, or simply open and redirect to that directory.
- Run
hexo init
Then your directory will be looked something similar to this:
1 | . |
Things might change by the version you installed, but should be more or less the same (or not).
Get your Website work
Get hexo-deployer-git
There are many options for deploying, here I choose
hexo-deployer-git
, simply because it’s the best way to get
your Hexo on GitHub Pages.
Run this in your terminal:
1 | npm install hexo-deployer-git |
And get to your nice directory (where you initialized Hexo), editing
_config.yml
(using any text editor, e.g., VS Code), to add following
code:
1 | deploy: |
OK here you would want to replace some of the keywords here to fit your own case.
In my case, it is:
1 | deploy: |
repo
- That is, to replace the
<repository url>
by the link of the empty repository you got from another step.
- That is, to replace the
branch
- And as for the
branch
, it’s normallymain
ormaster
, depending on your repository.- Can be checked by visiting https://github.com/your-name/your-repository/branches
- E.g., https://github.com/yifen9/yifen9.github.io/branches
- Here you can see that my branch is
main
, that’s why
- Here you can see that my branch is
- E.g., https://github.com/yifen9/yifen9.github.io/branches
- Notice that you can also replace it by other branches, if you know what you are doing.
- Can be checked by visiting https://github.com/your-name/your-repository/branches
- And as for the
Notice that when you initialize Hexo, it is possible that the system
has already generate the whole code or part of the code for deploying in
_config.yml
for you.
In that case, you don’t need to add full code in
_config.yml
, but to fill the difference.
Deploy Hexo
Open a terminal in the directory (Initializing Directory), run:
1 | hexo clean |
Or simply:
1 | hexo clean && hexo g && hexo d |
Visit Hello World
OK now check your repository again, it should be full of some random files.
Then you should be able to access you website already, by visiting https://your-username.github.io
- E.g., https://yifen9.github.io
If you can see something, a Hello World like what I got (see Hello World), then you are done.
GET A BETTER WEBSITE
To be continued…