GitHub pages for a personal site. How to expand a folder
If I use GitHub pages for my personal site, how do I manage my source files? I have a simple setup that works.
But I realize I can't use Jekyll plugins with GitHub pages. If I want to use Grunt, for example, to optimize my images for a regular application / site, it will output the result in a folder dist/public
that I will deploy. But I want to use GitHub to manage my source files, how do I do that?
source to share
Depending on the type of repository you are using, user / organization site ( UO ) or project site ( P ), sources and pages will be published to:
- User / Organization - Sources: Sources , Pages: Master
- Project - sources: master , pages: gh-pages
Note: the page branch is required, but the source branch name can be changed.
Customization
- Initialize empty github repository: github.com/userName.github.io for UO or github.com/repositoryName for P
Initialize the local repository locally:
- Go to the source folder
cd /home/username/www/yoursite
or whatever. - git init
-
git remote add origin git@github.com:userName/userName.github.io.git
( UO ) orgit remote add origin git@github.com:userName/repositoryName.git
( P ) -
git checkout -b sources
( UO ) orgit checkout master
( P ) - in .gitignore add
dist/public
. Since you are currently onmaster
, we will ignore its version in another branch - git add -A
- git commit -m "base sources". You have now transferred your sources.
-
git push origin sources
( UO ) orgit push origin master
( P ) push your sources into the appropriate branch -
cd dist/public
-
touch .nojekyll
, this file tells gh pages that there is no need to create a Jekyll site -
git init
-
git remote add origin git@github.com:userName/userName.github.io.git
( UO ) orgit remote add origin git@github.com:userName/repositoryName.git
( P ) -
git checkout master
( UO ) orgit checkout -b gh-pages
( P ) pushes this repository to the appropriate branch - Your task is
grunt
here -
git add -A
-
git commit -m "first build"
commit your site code -
git push origin master
( UO ) orgit push origin gh-pages
( P )
You have now pushed your code and pages on two different branches. Now they will be clicked depending on where you are:
pushing sources
-
cd yourWorkingDirestory
-
git add -A
-
git commit -m "your commit message"
-
git push origin sources
( UO ) orgit push origin master
( P )
clicking pages
-
cd yourWorkingDirestory/dist/public
-
git add -A
-
git commit -m "your commit message"
-
git push origin master
( UO ) orgit push origin gh-pages
( P )
source to share