Skip to content

Commit

Permalink
Added support and documentation for deploying to subdirectories (like
Browse files Browse the repository at this point in the history
with gh-pages)
  • Loading branch information
imathis committed Jul 16, 2011
1 parent 4855ef5 commit f81bdbc
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 16 deletions.
4 changes: 3 additions & 1 deletion .themes/classic/plugins/category_generator.rb
Expand Up @@ -129,8 +129,10 @@ module Filters
# Returns string
#
def category_links(categories)
dir = @context.registers[:site].config['category_dir']
root_url = @context.registers[:site].config['root']
categories = categories.sort!.map do |item|
"<a class='category' href='/#{@context.registers[:site].config['category_dir']}/#{item.gsub(/_|\W/, '-')}/'>#{item}</a>"
"<a class='category' href='#{root_url}/#{dir}/#{item.gsub(/_|\W/, '-')}/'>#{item}</a>"
end

case categories.length
Expand Down
2 changes: 1 addition & 1 deletion .themes/classic/source/_includes/archive_post.html
@@ -1,5 +1,5 @@
{% capture category %}{{ post.categories | size }}{% endcapture %}
<h1><a href="{{ post.url }}">{{post.title}}</a></h1>
<h1><a href="{{ site.root }}{{ post.url }}">{{post.title}}</a></h1>
<time datetime="{{ post.date | datetime }}" pubdate>{{ post.date | date: "<span class='month'>%b</span> <span class='day'>%d</span> <span class='year'>%Y</span>"}}</time>
{% if category != '0' %}
<footer>
Expand Down
4 changes: 2 additions & 2 deletions .themes/classic/source/_includes/article.html
@@ -1,7 +1,7 @@
{% unless page.no_header %}
<header>
{% if index %}
<h1 class="entry-title"><a href="{{ post.url }}">{{ post.title | titlecase }}</a></h1>
<h1 class="entry-title"><a href="{{ site.root }}{{ post.url }}">{{ post.title | titlecase }}</a></h1>
{% else %}
<h1 class="entry-title">{{ page.title | titlecase }}</h1>
{% endif %}
Expand All @@ -13,7 +13,7 @@ <h1 class="entry-title">{{ page.title | titlecase }}</h1>
{% if index %}
<div class="entry-content">{{ content | exerpt | smart_quotes }}</div>
<footer>
<a rel="full-article" href="{{ post.url }}">Read on &rarr;</a>
<a rel="full-article" href="{{ site.root }}{{ post.url }}">Read on &rarr;</a>
</footer>
{% else %}
<div class="entry-content">{{ content | smart_quotes }}</div>
Expand Down
2 changes: 1 addition & 1 deletion .themes/classic/source/_includes/asides/pinboard.html
Expand Up @@ -12,7 +12,7 @@ <h1>My Pinboard</h1>
var pinboardInit = document.createElement('script');
pinboardInit.type = 'text/javascript';
pinboardInit.async = true;
pinboardInit.src = '/javascripts/pinboard.js';
pinboardInit.src = '{{ site.root }}/javascripts/pinboard.js';
document.getElementsByTagName('head')[0].appendChild(pinboardInit);
})();
</script>
Expand Down
2 changes: 1 addition & 1 deletion .themes/classic/source/_includes/asides/recent_posts.html
Expand Up @@ -3,7 +3,7 @@ <h1>Recent Posts</h1>
<ul id="recent_posts">
{% for post in site.posts limit: site.recent_posts %}
<li class="post">
<a href="{{ post.url }}">{{ post.title }}</a>
<a href="{{ site.root }}{{ post.url }}">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
Expand Down
2 changes: 1 addition & 1 deletion .themes/classic/source/_includes/asides/twitter.html
Expand Up @@ -9,7 +9,7 @@ <h1>Latest Tweets</h1>
getTwitterFeed("{{site.twitter_user}}", {{site.twitter_tweet_count}}, {{site.twitter_show_replies}});
});
</script>
<script src="/javascripts/twitter.js" type="text/javascript"> </script>
<script src="{{ site.root }}/javascripts/twitter.js" type="text/javascript"> </script>
{% if site.twitter_follow_button %}
<a href="http://twitter.com/{{ site.twitter_user }}" class="twitter-follow-button" data-width="208px" data-show-count="{{ site.twitter_show_follower_count }}">Follow @{{ site.twitter_user }}</a>
{% else %}
Expand Down
10 changes: 5 additions & 5 deletions .themes/classic/source/_includes/head.html
Expand Up @@ -19,14 +19,14 @@
<meta name="keywords" content="{{page.keywords}}"/>
{% endif %}

<link href="/images/favicon.png" rel="shortcut icon" />
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<script src="/javascripts/modernizr-2.0.js"></script>
<link href="{{ site.url }}/images/favicon.png" rel="shortcut icon" />
<link href="{{ site.url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<script src="{{ site.url }}/javascripts/modernizr-2.0.js"></script>
<script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<script src="{{ site.url }}/javascripts/octopress.js" type="text/javascript"></script>
<link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
<link href="/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/>
<link href="{{ site.url }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/>
{% include google_analytics.html %}
{% include google_plus_one.html %}
{% include twitter_sharing.html %}
Expand Down
2 changes: 1 addition & 1 deletion .themes/classic/source/_includes/header.html
@@ -1,5 +1,5 @@
<hgroup>
<h1><a href="/">{{ site.title }}</a></h1>
<h1><a href="{{ site.root }}">{{ site.title }}</a></h1>
{% if site.subtitle %}
<h2>{{ site.subtitle }}</h2>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions .themes/classic/source/_includes/navigation.html
Expand Up @@ -11,6 +11,6 @@
</fieldset>
</form>
<ul role="main-nav">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
<li><a href="{{ site.root }}/">Blog</a></li>
<li><a href="{{ site.root }}/blog/archives">Archives</a></li>
</ul>
17 changes: 17 additions & 0 deletions README.markdown
Expand Up @@ -118,6 +118,23 @@ The `config_deploy` rake task takes a branch name as an argument and creates a [
This prepares your branch for easy deployment. The `rake deploy` task copies the generated blog from the `public` directory to the `_deploy` directory, adds new files, removes old files, sets a commit message, and pushes to Github.
Github will queue your site for publishing (which usually occurs instantly or within minutes if it's your first commit).

**Please note,** Github's project pages will be published to a subdirectory and you'll have to make sure you set up your urls correctly in your configs.

For Octopress my cofigs would be set up like this:

# _config.yaml
destination: public/octopress
url: http://imathis.github.com/octopress
subscribe_rss: /octopress/atom.xml
root: /octopress

# config.rb
http_path = "/octopress"

# Rakefile
public_dir = "public/octopress"


## License
(The MIT License)

Expand Down
9 changes: 8 additions & 1 deletion _config.yml
Expand Up @@ -22,7 +22,14 @@ recent_posts: 5
category_dir: blog/categories
simple_search: http://google.com/search

# Optional configurations
# ----------------------- #
# Optional configurations #
# ----------------------- #

# If publishing to a subdirectory as in http://site.com/project set this:
# root: /project
# If left blank, urls will be mapped to '/'
root:

# RSS feeds can list your email address if you like
email:
Expand Down

0 comments on commit f81bdbc

Please sign in to comment.