Reputation: 166
I'm wanting to have both a user website and multiple project websites hosted on Github Pages i.e.
I'd like them to share a common set of jekyll files so it's easier to change themes, info, etc.. Has anyone managed to do this? Using subtree / submodule isn't too helpful because you cannot overwrite the source config option to change the location of the jekyll source files. Github Pages always forces the source to be in the root directory. You can change where _includes and _layouts reside but that's not too useful. Any advice or examples?
Upvotes: 1
Views: 357
Reputation: 7795
Use username.github.ui/base
as your repository with your base templates. This shouldn't be a gh-page.
This repository should contain a branch with your base templates. For the moment, I say you are using the master
branch for that. Branch out and create a project1
and project2
branch in this repo.
Every time you change your base templates, change them in the master
branch and then merge the master branch into project1
and project2
.
Clone the base
repo locally, and add project1
and project2
both as remotes.
Then simply do a git push project1 project1:gh-pages
to push your local project1
branch to the first projects gh-pages branch.
This will still multiply the files, but it will mean that you can easily keep them in sync. Changing your base templates would be like this:
git pull
project1's gh-pages branch into the base repos project1
branch. Repeat for project2.base
repo.project1
and project2
branchesgit push
project1's branch into project1s
gh-pages` branch. Repeat for #2.If you set up some hooks this can be automated fairly easy.
Upvotes: 1