From charlesreid1

No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
Treat this the same way you treat [[Jekyll]]:
This guide covers how I installed  Octopress for Github pages.


1. Manually copy all the Octopress repository files into their own directory <code>project/octopress/</code>
=Installation=


2. Manually check out a copy of the <code>gh-pages</code> branch to <code>_deploy</code>  inside the new Octopress directory (<code>_deploy</code> is the Octopress version of Jekyll's <code>_site</code>)
==Create Your Project Repo==


3. Make your posts, change your site, do whatever
I assume you know how to make a new repo. Now you just clone your repo. I'll use the project I was working on, <code>cantera-book</code>:


4. <code>bundle exec rake generate && bundle exec rake deploy</code> to generate static HTML files for site in _deploy
<pre>
git clone https://github.com/charlesreid1/cantera-book
</pre>


5. When happy with static HTML site, <code>cd project/octopress/_deploy && git add . && git commit -am "Updating gh-pages branch" && git push origin gh-pages</code>
==Create Your Project Github Page==


6. When happy with site changes, posts, etc., <code>cd project/octopress && git add . && git commit -am "Updating octopress site source" && git push origin master</code>
Github project pages work differently from Github user pages.
 
For a user page, the Octopress source code is contained in the <code>source</code> branch (or, whatever branch you want), and the live static content is deployed to the <code>master</code> branch (not whatever branch you want).
 
However, for Github project pages, the source code is contained in the <code>master</code> branch (or, whatever branch you want), and the live static content is deployed to the <code>gh-pages</code> branch (not whatever branch you want).
 
Thus, you can create your Github project page by creating a <code>gh-pages</code> branch:
 
<pre>
cd cantera-book/
git checkout --orphan gh-pages
</pre>
 
If you made a basic index.html in this directory, and committed your change to the repo, it would show up on your Github project page.
 
But we will let Octopress make the content. Switch back to the master branch:
 
<pre>
git checkout master
</pre>
 
==Install Octopress Files==
 
Use the Octopress repo from imathis (https://github.com/imathis/octopress), or fork it and make your own flavor of Octopress.
 
You need to copy all the Octopress repository files into their own directory <code>project/octopress/</code>.
 
But this is where things get hacky.
 
Deploying an Octopress to a Github project page did NOT work for me if octopress was living as a cloned copy of the Octopress repo (with the full history of imathis's Octopress repo) inside your project's Github.
 
So I had to copy the non-git files, like this:
 
<pre>
cp -r /path/to/githubrepo/octopress/* /path/to/project/cantera-book/octopress/.
cp -r /path/to/githubrepo/octopress/.themes /path/to/project/cantera-book/octopress/.
</pre>
 
Now you should be ok.
 
==Install Theme==
 
Install your theme,
 
<pre>
cd cantera-book/octopress
bundle exec rake install
</pre>
 
==Setup Github Pages==
 
<pre>
bundle exec rake setup_github_pages
</pre>
 
WARNING: Potential Octopress bug here. I fed my project page,
but it ignored the name of the project page and tried to call the project
"github". It deployed everything to subfolders called "github," and just
acted weirdly. to get it to work, I ended up having to manually edit some config files.
 
==Edit Config Files==
 
Edit <code>_config.yml</code>:
 
<pre>
line: 19
before: subscribe_rss: /github/atom.xml
after: subscribe_rss: /atom.xml
 
line: 29
before: root: /github
after: root: /
</pre>
 
[[Category:Octopress]]
[[Category:Github]]

Latest revision as of 06:22, 5 August 2014

This guide covers how I installed Octopress for Github pages.

Installation

Create Your Project Repo

I assume you know how to make a new repo. Now you just clone your repo. I'll use the project I was working on, cantera-book:

git clone https://github.com/charlesreid1/cantera-book

Create Your Project Github Page

Github project pages work differently from Github user pages.

For a user page, the Octopress source code is contained in the source branch (or, whatever branch you want), and the live static content is deployed to the master branch (not whatever branch you want).

However, for Github project pages, the source code is contained in the master branch (or, whatever branch you want), and the live static content is deployed to the gh-pages branch (not whatever branch you want).

Thus, you can create your Github project page by creating a gh-pages branch:

cd cantera-book/
git checkout --orphan gh-pages

If you made a basic index.html in this directory, and committed your change to the repo, it would show up on your Github project page.

But we will let Octopress make the content. Switch back to the master branch:

git checkout master

Install Octopress Files

Use the Octopress repo from imathis (https://github.com/imathis/octopress), or fork it and make your own flavor of Octopress.

You need to copy all the Octopress repository files into their own directory project/octopress/.

But this is where things get hacky.

Deploying an Octopress to a Github project page did NOT work for me if octopress was living as a cloned copy of the Octopress repo (with the full history of imathis's Octopress repo) inside your project's Github.

So I had to copy the non-git files, like this:

cp -r /path/to/githubrepo/octopress/* /path/to/project/cantera-book/octopress/.
cp -r /path/to/githubrepo/octopress/.themes /path/to/project/cantera-book/octopress/.

Now you should be ok.

Install Theme

Install your theme,

cd cantera-book/octopress
bundle exec rake install

Setup Github Pages

bundle exec rake setup_github_pages

WARNING: Potential Octopress bug here. I fed my project page, but it ignored the name of the project page and tried to call the project "github". It deployed everything to subfolders called "github," and just acted weirdly. to get it to work, I ended up having to manually edit some config files.

Edit Config Files

Edit _config.yml:

line: 19
before: subscribe_rss: /github/atom.xml
after: subscribe_rss: /atom.xml

line: 29
before: root: /github
after: root: /