Repo Setup for Hexo?

1.2k Views Asked by At

I'm finally getting around to migrating my blog to some markdown goodness and hexo seemed to be the best option for me. I seem to be missing something about the workflow from hexo project to github pages though.

Should the hexo project live in one repo and then publish the generated content to a separate pages repo? Or is there some other mechanism (like branching) that should be used?

The former seems to be the most likely but I thought I'd ask first. Sorry if it seem s obvious, I may have confused myself reading about jekyll etc earlier.

2

There are 2 best solutions below

3
On BEST ANSWER

Depending of the type or site your deploying : user/organization or project, your code must be respectively pushed in master or gh-pages branch (see gh page doc here).

http://flukus.github.io/ -> master

http://flukus.github.io/myproject -> gh-pages

Setup you github configuration (or other hoster) in you _config.yml like described here.

Additionally you'll have to create an empty .nojekyll file at the root of your repository to instruct Github pages not to process you site as a Jekyll site.

hexo generate --deploy will then do it well.

0
On

maybe you can build a repo, the constructure is like this:

  • repo: xxx.github.io
    • branch: hexo(store your hexo source file)
    • branch: master(store you Blog static pages)

and set the branch hexo to default branch.

and now, build the hexo environment, just mkdir a new floder like D:\hexo, and npm install hexo,hexo init,npm install,npm install hexo-deployer-git

then, connect you local floder to your github repo, git bash here:

cd D:\hexo
git init
git remote add origin <your github repo clone url>
git checkout hexo

then update the .gitignore file, add a ilne:

public/

then update your _config.yml:

deploy:
    type: git
    repo: [email protected]:xxx/xxx.github.io.git #your own ssh url, http url is also ok
    branch: master

the git bash here:

git add .
git commit -m "haha"
git push -f origin hexo

last, deploy your Blog:

hexo d -g