Browse Source

Added support and documentation for deploying to subdirectories (like

with gh-pages)
unreleased_contents
Brandon Mathis 13 years ago
parent
commit
f81bdbc1a8
  1. 4
      .themes/classic/plugins/category_generator.rb
  2. 2
      .themes/classic/source/_includes/archive_post.html
  3. 4
      .themes/classic/source/_includes/article.html
  4. 2
      .themes/classic/source/_includes/asides/pinboard.html
  5. 2
      .themes/classic/source/_includes/asides/recent_posts.html
  6. 2
      .themes/classic/source/_includes/asides/twitter.html
  7. 10
      .themes/classic/source/_includes/head.html
  8. 2
      .themes/classic/source/_includes/header.html
  9. 4
      .themes/classic/source/_includes/navigation.html
  10. 17
      README.markdown
  11. 9
      _config.yml

4
.themes/classic/plugins/category_generator.rb

@ -129,8 +129,10 @@ module Jekyll
# 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

2
.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>

4
.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 %}
@ -13,7 +13,7 @@
{% 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>

2
.themes/classic/source/_includes/asides/pinboard.html

@ -12,7 +12,7 @@
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>

2
.themes/classic/source/_includes/asides/recent_posts.html

@ -3,7 +3,7 @@
<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>

2
.themes/classic/source/_includes/asides/twitter.html

@ -9,7 +9,7 @@
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 %}

10
.themes/classic/source/_includes/head.html

@ -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 %}

2
.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 %}

4
.themes/classic/source/_includes/navigation.html

@ -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
README.markdown

@ -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)

9
_config.yml

@ -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:

Loading…
Cancel
Save