How to host a reveal.js presentation
Nowadays (October, 2016) you don't need to create a specific branch (gh-pages) anymore. Create your repo then select 'Settings -> Options'. There is a 'GitHub Pages' panel where you can set any branch to be published as web pages.
Bruno's answer is very good as a one-off solution. But, if a user wants to host several presentations in GitHub Pages, then they would need to repeat the procedure every time. Another approach is to use one GitHub repository for multiple presentations.
Here are the steps:
- Create a clean repository in GitHub (without README etc.), say
presentations
Initialise the git repo and link to GitHub, in Linux that would be
mkdir presentations cd presentations git init git remote add origin [email protected]:username/presentations.git
Add
reveal.js
as "remote" and pull the repositorygit remote add upstream [email protected]:hakimel/reveal.js.git git pull upstream master
Create an empty branch for your presentation and clean the working directory
git checkout --orphan my-fancy-presentation git reset --hard
Copy presentation to current folder and commit your changes
cp path/to/my_fancy_presentation.html . git add . git commit -m 'Initial commit'
Switch to master and merge your presentations there
git checkout master git merge my-fancy-presentation
Push all branches to GitHub
git push --all origin
Set up GitHub Pages to branch
master
and enjoy your presentation athttps://username.github.io/presentations/my_fancy_presentation.html
Now, whenever you want to add another presentation, you just need to repeat steps 4-7. Besides, whenever you want to update reveal.js
, you can simply do git pull upstream master
.
As an example of this approach, see https://github.com/dougmvieira/presentations.
Create a new repository on GitHub
Let’s call it
reveal_HelloWorld
Clone it on your local machine:
git clone [email protected]:yourusername/reveal_HelloWorld.git
Clone reveal.js on your local machine:
git clone [email protected]:hakimel/reveal.js.git
Move the content of
reveal.js
folder into thereveal_HelloWorld
folderModify the
index.html
fileCreate and switch to a new branch
git checkout -b 'gh-pages'
Push
git push
From the GitHub website repo settings:
- Set the ‘gh-pages’ branch as default
- Delete the ‘master’ branch
You are done.
The slides are published at yourusername.github.io/reveal_HelloWorld
.
Source: How to deploy Reveal.js presentations on Github
Screencast: https://vimeo.com/241196662
Credit: Angelo Basile