imathis/octopress — pull request #284 by simensen (2011-11-17 06:06:23+00:00)
Title: Support local configuration that can be managed outside of repository

This change will allow individual users to opt into managing their customized configuration outside of the base configuration.

Old workflow:

* Modify `_config.yml` to reflect correct blog info
* Commit changes to fork
* Merge changes from upstream
* Deal with potential conflicts in `_config.yml`

New workflow:

* Create `_localconfig.yml` and update it to reflect correct blog info
* Add and commit changes to fork
* Merge changes from upstream
* No potential for conflict on `_localconfig.yml` since it isn't in upstream repository at all

I think it is important to note that this is **opt in**. Users would still be able to continue to just update `_baseconfig.yml` if they wanted to.

One issue is that although the rest of the system (any of the ruby/rake code) will be aware of the merged configuration by way of the `config` object, Jekyll itself will only read `_config.yml` raw and cannot be aware of any additional configuration from another file.

I had hoped to leave the base file named `_config.yml` and write out the combined file as `_jekyllconfig.yml` but to the best of my knowledge Jekyll cannot be told to read another configuration file. As a result, I moved `_config.yml` to `_baseconfig.yml` and write the entire merged configuration to `_config.yml` so that Jekyll can reference configuration values set in `_localconfig.yml`.

I think this would open up the door to some other potentially cool things that could be done with dynamic configuration with Jekyll that wasn't really possible before.

This is also the foundation for a few other bigger changes I want to make in the near future. My goal is to make it possible to easily maintain the entirety of a site/blog outside of the Octopress directory. I'm pretty close to being able to do that, but I'm going to need some sort of support for this type of local configuration capabilities to do it. So I'm happy to discuss this solution at great length if needed as I have a vested interest in making sure something like this makes it into octopress. :)

### Quick example
Here is an example of my `_localconfig.yml`:

```yaml
url: http://srcmvn.com
title: Source Maven
subtitle: Code Partition for Beau Simensen
author: Beau Simensen

source: /home/altern8/workspaces/srcmvn.com/source
blog_index_dir: /home/altern8/workspaces/srcmvn.com/source
actual_blog_root: /home/altern8/workspaces/srcmvn.com

github_user: simensen
github_repo_count: 5
github_skip_forks: false

twitter_user: srcmvn
twitter_tweet_count: 5

googleplus_user: 114524966156217554571
googleplus_hidden: true

disqus_short_name: srcmvn

google_analytics_tracking_id: UA-12685022-2
```

With the code in this PR, I could drop that `_localconfig.yml` file into a fresh Octopress clone and everything would be configured correctly without having to change any files that live in the upstream repository.

```
git add _localconfig.yml
git commit -m 'My configuration'
git push origin
```

My site's configuration is now under revision control and will never conflict on merge from upstream.