This repository is meant for Yunpeng's personal blog website. It is proudly powered by Hexo.js. In a previous blog, I shared the reasons why I chose to blog with Hexo.js.
- Production Site: https://yunpengn.github.io/blog/
- Staging Site: https://yunpengn-blog.netlify.app/
- Make sure you have installed the latest version of Node.js, Npm and Git on your development machine. Npm should come with Node.js.
- You chould check them by
git --version
,node -v
andnpm -v
.
- You chould check them by
- Fork and clone this repository to your computer.
git clone --recurse-submodules [email protected]:yunpengn/blog.git
- Navigate to this directory.
cd blog
- Install all the dependencies stated in
package.json
(orpackage-lock.json
).
npm install
- Run the Hexo server to host the website locally.
npm start
- Now, you can visit the website at
http://localhost:4000/blog/
.
- Run the following command to create a new post
- Surround
<title>
with quotation marks if there exists whitespaces.
- Surround
hexo new <title>
- Run the following command to create a draft
hexo new draft <title>
- Run the following command to transform a draft into a post
hexo publish <title>
- If you have customize layout under the
scaffolds
folder, you can apply it by
hexo new <layout> <title>
Currently, this blog is being deployed to two environments concurrently, production site on GitHub Pages, as well as staging site on Netlify. The details for these two environments are described as follows respectively.
We use the Git deployer plugin for Hexo to deploy the site to the gh-pages
branch, which is then picked up by GitHub Pages automatically.
- You should have followed the section above to set up the local development environment.
- Check the settings in
_config.yml
is correct (see Hexo's documentation for more details):
deploy:
type: git
repo: <The URL to your Git repository>
branch: <The branch for deployment>
message: <The commit message>
- Deploy the website by running
npm run deploy
. Prior to doing this, check that you have access to the Git repository.
We are also using Netlify as a CI/CD service to host the staging site. The relevant configuration for Netlify can be found in the file netlify.toml. The staging pipeline would run whenever you push the changes to this GitHub repository and there is no manual step involved.
You should take special note that the Hexo.js configuration file for the staging environment is different. This is due to the differences in base URL and root path between the two environments. When running the Hexo commannds, make sure you suffix them with --config _config_netlify.yml
.
Fetched in submodule path 'themes/next', but it did not contain
XXXX
. Direct fetching of that commit failed.
This is usually because the master head of the theme repository has been changed recently. Solve this by cd themes/next && git checkout master && git pull
.
Copyright © 2017 - Present by Niu Yunpeng
This project (Yunpeng's Blog) is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License ("the licence"). Based on a work at this repository.
The licence generally grants you the freedom that
- You are free to share, copy and redistribute the material in any medium or format
under the following terms:
- You must give appropriate credit, provide a link to the license, and indicate if changes were made; and
- You may not use the material for commercial purposes; and
- If you remix, transform, or build upon the material, you may not distribute the modified material; and
- You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
In summary, the licence mentioned above allows you to view and share this work in its original form via any meidum. However, you are NOT allowed to modify it for other uses (such as to create your own website).
A copy of the licence has been attached to this repository, and can be found here. You may seek permissions beyond the scope of this license by contacting the author at [email protected].