Omnicommons.org

Omnicommons.org (link) is the main website for the Omni Commons.

Development
The best way to add changes to the website is to fork the main repository (github.com/omnicommons/omnicommons.org) then clone your fork to your local machine and test your changes locally before committing a pull request.

The following text will go over how to get the code on to your local machine and how to configure the machine to display the website, read on!

Fork, Clone, and Configure the Upstream
We assume you already know how to fork a github.com repository, if not please check out github’s article on repo forking

Clone the Repo
Once you have the repository forked you’ll want to clone it to your development machine using the clone command.

Here’s the command that github user dhornbein used:

Note: This command will be different for you as  will be replaced by your github.com user name (or where ever you forked the repo)

Configure Remote Upstream
The “remote upstream” is a git remote repo that you pull from for the latest versions of the code. You will add the Omni Common’s omnicommons.org repository as the upstream remote location so you can perform  to pull down any changes to the site since you forked it.

First we’ll add the upstream remote, you can copy and paste the line below:

Now check that it worked by typing  to see all remote repos, it should look like this:

origin git@github.com:dhornbein/omnicommons.org.git (fetch) origin git@github.com:dhornbein/omnicommons.org.git (push) upstream git@github.com:omnicommons/omnicommons.org.git (fetch) upstream git@github.com:omnicommons/omnicommons.org.git (push) Basically this is saying that the origin of the files is at your (show as dhornbein’s) forked repo and the upstream destination is the Omni Common’s repo.

Setting up Server Side Includes on Localhost
The Omni Commons website uses Server Side Includes (SSI) to pull in head, nav, and footer html from the  folder. So we need to set up your local environment to handle this. Much of the following information is taken from linuxtopia.org’s how to guide on apache ssi.

The SSI strings look like this:

Once SSI is enabled this line will be replaced by the content of. This allows us to edit the nav once and have those changes appear on all pages with the above snippet.

Enable mod_include
The first thing to do is ensure that your server has the mod_include module installed and enabled.

The following instructions were tested on an Mac OS X (10.9) machine but should work on any Linux machine as well.

First we will examine the Apache Config file  typically located at:

Make sure that the includes modual is present and active by searching for  within the   file, look for this line:

Check that there isn’t a hash (#) in front of the above text (you’re text might differ slightly).

Turn on Includes
You’ll want to turn on the include option through your virtual host by adding:

Here’s Drew’s vhost as an example:

&lt;Virtualhost *:80&gt; VirtualDocumentRoot &quot;/Users/drew/www/%-2/&quot; ServerName vhosts.localhost ServerAlias *.localhost ErrorLog &quot;/var/log/apache2/vhosts.localhost-error_log&quot; &lt;Directory &quot;/Users/drew/www/*&quot;&gt; Options Indexes FollowSymLinks +Includes AllowOverride All Order allow,deny Allow from all &lt;/Directory&gt; &lt;/Virtualhost&gt; Side Note: Drew is using a nifty trick to automagically add folders in  to their virtual host, you can read more about that on Glen Scott’s blog post Simple Development Hosts on Mac

Pay attention to the line where  has been added:

Now we need to tell Apache to scan the proper files for includes. Typically, due to the extra server overhead, this is done only to files that are specified as having includes by using a special extension  to indicate to the system that they should be scanned.

The OmniCommons website uses  throughout, so we simply need to tell our local apache server to scan all   files for includes.

Go back to your  and find the line with   now add under that line:

The hash (#) indicates that a line is commented out, because we want the config file to read our command we omit that hash. So this command is adding an output filter that applies Includes  to all html files.

You should now be able to visit your virtual host, in Drew’s case it is.

Remember: The apache include will not run if you open the .html file directly in your browser, it must be served from the virtual host.