Hello, My Page
- Use
Github Pages
andHexo
to host your own blog.
Install and Config
GitHub Pages
- You need to
Register GitHub
andInstall Git
- New repository, repository name is
yourname.github.io
- Settings - GitHub Pages - Launch automatic page generator
Hexo
- Install Node.js, since you need use
npm
(node package management) Choose an empty folder, for example
hexo
, input123$ cd hexo$ npm install hexo-cli -g$ npm install hexo --saveInput
1$ hexo -vIf you can see the version information, you have successfully install Hexo.
- My structure is like below. Some folders will be added after following steps, and now you can ignore it.12345678910111213141516171819- hexo- .deploy_git- node_modules- public- scaffolds- source- _posts- about- tags- categories- images- themes- landscape- next.gitignore_config.ymldb.jsondebug.logpackage.json
Configuration
- You can modify site settings in
_config.yml
with Docs of Configuration.
Themes
Busuanzi
- You can use
busuanzi
to count viewers - Open
themes/next/layout/_config.yml
and modify the settingsenable:true
ofbusuanzi_count
|
|
- Open
themes/next/layout/_partials/footer.swig
- Add the following code at the beginning.
|
|
- Add the following code at the end.
|
|
Create and Deploy
Create a new post
Input
1$ hexo new "My New Post"You can write your post like
123456789101112131415---# Yaml or Jsontitle: Hello, My Pagedate: 2017-09-15 00:00:00updated: 2021-03-20tags:- GitHub Pages- Hexo- NexT- CS Learningcategories:- CS Learning---<!-- Markdown --># Hello, My Page- More Detail for front matter
Create a new page(such as about/tags/categories)
Input
1$ hexo new page "about"You will find a new folder named
about
in your source folder, and aindex.md
file in it.- You can write your
index.md
like123456---title: 关于date: 2017-09-17 15:53:11type: "about"---## About me.
Run server
The first time you want to run server, you need install
hexo-server
, which has been separated from the main module.1$ npm install hexo-server --saveOnce the server has been installed, input
1$ hexo server // or you can input `hexo s`Your website will run at
http://localhost:4000
. It’s not necessarily for you to restart the server since hexo will watch for file changes and update automatically.- More Detail
Generate and deploy
Input
1$ hexo d -g- More Detail for Deploy
Clean the cache
Input
1$ hexo cleanYou can delete the post in the
_post
folder and then clean the cache to delete the post.