About
This Hexo static site generator has been versioned on Gitlab with a git submodule based on Hexo-Hueman theme.
This topic deals with :
- a local machine where your project will be created and maintained.
- a remote production web-server with Git installed.
Requirements
- Install on your local machine :
- Install Git on your production server .
Setup
We have to maintain two repositories for this project : theme (A) and Hexo one (B).
A. Custom theme project based on Hueman
We choose to keep our custom theme updated from original Hexo-Hueman project originally hosted in Github.
Create your theme project
Create an empty theme project on Gitlab, then locally :
mkdir your-theme-project |
Configuration
This theme requires 2 peer dependencies hexo-pwa and hexo-multiauthor that will NOT be added to parent project package.json file because of conflicts.
- Rename
_config.yml.example
to_config.yml
. - Add your logo in
sources/css/images/
and configure your theme. - Commit and push changes.
B. Main Hexo project
Even if Hexo could be run directly on a web-server and listening for changes, we choose to publish only static files hosted in the public/
folder from a dedicated production branch thanks to Hexo Git deployer plugin.
Create your blog project
Create an empty blog project on Gitlab, then locally :
hexo init your-project |
Configuration
Update your _config.yml
for deployment :
# Deployment |
Commit your changes and push to origin master, then run hexo clean && hexo deploy
.
At this point, a new branch called production is created or updated on your Gitlab repository.
Those two commands only affect this remote branch so master one is not concerned about it.
You still have to publish commits on your master branch to keep your working project up to date.
Workflow
Once first time
- Clone locally your main project from Gitlab including his submodule:
git clone --recursive https://gitlab.com/your-project.git
. - Install dependencies
yarn install
. - Connect to your web-server by SSH and clone your Gitlab production branch:
git clone --single-branch -b production https://gitlab.com/your-project.git
.
Working on your project
- Start your local server and render drafts:
hexo server --draft
. - Add your posts, drafts, pages … with Hexo CLI.
- Commit changes and push.
- Generate and push into production branch your static files that lives into
public/
folder:hexo clean && hexo deploy
. - Connect to your web-server by SSH and pull changes.