... | ... |
@@ -19,14 +19,14 @@ |
19 | 19 |
<meta name="keywords" content="{{page.keywords}}"/> |
20 | 20 |
{% endif %} |
21 | 21 |
|
22 |
- <link href="{{ site.url }}/images/favicon.png" rel="shortcut icon" /> |
|
23 |
- <link href="{{ site.url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> |
|
24 |
- <script src="{{ site.url }}/javascripts/modernizr-2.0.js"></script> |
|
22 |
+ <link href="{{ site.root }}/images/favicon.png" rel="shortcut icon" /> |
|
23 |
+ <link href="{{ site.root }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> |
|
24 |
+ <script src="{{ site.root }}/javascripts/modernizr-2.0.js"></script> |
|
25 | 25 |
<script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script> |
26 |
- <script src="{{ site.url }}/javascripts/octopress.js" type="text/javascript"></script> |
|
26 |
+ <script src="{{ site.root }}/javascripts/octopress.js" type="text/javascript"></script> |
|
27 | 27 |
<link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> |
28 | 28 |
<link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> |
29 |
- <link href="{{ site.url }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> |
|
29 |
+ <link href="{{ site.root }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> |
|
30 | 30 |
{% include google_analytics.html %} |
31 | 31 |
{% include google_plus_one.html %} |
32 | 32 |
{% include twitter_sharing.html %} |
... | ... |
@@ -13,13 +13,13 @@ blog_index: true |
13 | 13 |
<nav role="pagination"> |
14 | 14 |
<div> |
15 | 15 |
{% if paginator.next_page %} |
16 |
- <a class="prev" href="/page{{paginator.next_page}}/">← Older</a> |
|
16 |
+ <a class="prev" href="{{ site.root }}/page{{paginator.next_page}}/">← Older</a> |
|
17 | 17 |
{% endif %} |
18 |
- <a href="/blog/archives">Blog Archives</a> |
|
18 |
+ <a href="{{ site.root }}/blog/archives">Blog Archives</a> |
|
19 | 19 |
{% if paginator.previous_page and paginator.previous_page > 1 %} |
20 |
- <a class="next" href="/page{{paginator.previous_page}}/">Newer →</a> |
|
20 |
+ <a class="next" href="{{ site.root }}/page{{paginator.previous_page}}/">Newer →</a> |
|
21 | 21 |
{% elsif paginator.previous_page %} |
22 |
- <a class="next" href="/">Newer →</a> |
|
22 |
+ <a class="next" href="{{ site.root }}/">Newer →</a> |
|
23 | 23 |
{% endif %} |
24 | 24 |
</div> |
25 | 25 |
</nav> |
... | ... |
@@ -118,22 +118,46 @@ The `config_deploy` rake task takes a branch name as an argument and creates a [ |
118 | 118 |
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. |
119 | 119 |
Github will queue your site for publishing (which usually occurs instantly or within minutes if it's your first commit). |
120 | 120 |
|
121 |
-**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. |
|
122 | 121 |
|
123 |
-For Octopress my cofigs would be set up like this: |
|
122 |
+### Deploying to a Subdirectory (Github Project Pages does this) |
|
124 | 123 |
|
125 |
- # _config.yaml |
|
124 |
+If you're deploying to a subdirectory on your site, or if you're using Github's project pages, make sure you set up your urls correctly in your configs. |
|
125 |
+You can do this automatically: |
|
126 |
+ |
|
127 |
+ rake set_root_dir[your/path] |
|
128 |
+ |
|
129 |
+ # To go back to publishing to the document root |
|
130 |
+ rake set_root_dir[/] |
|
131 |
+ |
|
132 |
+Then update your `_config.yml` and `Rakefile` as follows: |
|
133 |
+ |
|
134 |
+ # Change the url in _config.yml |
|
135 |
+ url: http://yoursite.com/your/path |
|
136 |
+ |
|
137 |
+ # If deploying with rsync, update your Rakefile path |
|
138 |
+ document_root = "~/yoursite.com/your/path" |
|
139 |
+ |
|
140 |
+To manually configure deployment to a subdirectory, you'll change `_config.yml`, `config.rb` and `Rakefile` |
|
141 |
+ |
|
142 |
+ # Example for deploying to Octopress's Github Pages |
|
143 |
+ |
|
144 |
+ # _config.yml |
|
126 | 145 |
destination: public/octopress |
127 | 146 |
url: http://imathis.github.com/octopress |
128 | 147 |
subscribe_rss: /octopress/atom.xml |
129 | 148 |
root: /octopress |
130 | 149 |
|
131 |
- # config.rb |
|
150 |
+ # config.rb - for Compass & Sass |
|
132 | 151 |
http_path = "/octopress" |
152 |
+ http_images_path = "/octopress/images" |
|
153 |
+ http_fonts_path = "/octopress/fonts" |
|
154 |
+ css_dir = "public/octopress/stylesheets" |
|
155 |
+ |
|
133 | 156 |
|
134 | 157 |
# Rakefile |
135 | 158 |
public_dir = "public/octopress" |
136 |
- |
|
159 |
+ # If deploying with rsync, update your Rakefile path |
|
160 |
+ document_root = "~/yoursite.com/your/path" |
|
137 | 161 |
|
138 | 162 |
## License |
139 | 163 |
(The MIT License) |
... | ... |
@@ -124,7 +124,40 @@ task :push do |
124 | 124 |
end |
125 | 125 |
end |
126 | 126 |
|
127 |
-desc "setup _deploy folder and deploy branch" |
|
127 |
+desc "Update configurations to support publishing to root or sub directory" |
|
128 |
+task :set_root_dir, :dir do |t, args| |
|
129 |
+ puts ">>> !! Please provide a directory, eg. rake config_dir[publishing/subdirectory]" unless args.dir |
|
130 |
+ if args.dir |
|
131 |
+ if args.dir == "/" |
|
132 |
+ dir = "" |
|
133 |
+ else |
|
134 |
+ dir = "/" + args.dir.sub(/(\/*)(.+)/, "\\2").sub(/\/$/, ''); |
|
135 |
+ end |
|
136 |
+ rakefile = IO.read(__FILE__) |
|
137 |
+ rakefile.sub!(/public_dir(\s*)=(\s*)(["'])[\w\-\/]*["']/, "public_dir\\1=\\2\\3public#{dir}\\3") |
|
138 |
+ File.open(__FILE__, 'w') do |f| |
|
139 |
+ f.write rakefile |
|
140 |
+ end |
|
141 |
+ compass_config = IO.read('config.rb') |
|
142 |
+ compass_config.sub!(/http_path(\s*)=(\s*)(["'])[\w\-\/]*["']/, "http_path\\1=\\2\\3#{dir}/\\3") |
|
143 |
+ compass_config.sub!(/http_images_path(\s*)=(\s*)(["'])[\w\-\/]*["']/, "http_images_path\\1=\\2\\3#{dir}/images\\3") |
|
144 |
+ compass_config.sub!(/http_fonts_path(\s*)=(\s*)(["'])[\w\-\/]*["']/, "http_fonts_path\\1=\\2\\3#{dir}/fonts\\3") |
|
145 |
+ compass_config.sub!(/css_dir(\s*)=(\s*)(["'])[\w\-\/]*["']/, "css_dir\\1=\\2\\3public#{dir}/stylesheets\\3") |
|
146 |
+ File.open('config.rb', 'w') do |f| |
|
147 |
+ f.write compass_config |
|
148 |
+ end |
|
149 |
+ jekyll_config = IO.read('_config.yml') |
|
150 |
+ jekyll_config.sub!(/^destination:.+$/, "destination: public#{dir}") |
|
151 |
+ jekyll_config.sub!(/^subscribe_rss:.+$/, "subscribe_rss: #{dir}/atom.xml") |
|
152 |
+ jekyll_config.sub!(/^root:.*$/, "root: #{dir}") |
|
153 |
+ File.open('_config.yml', 'w') do |f| |
|
154 |
+ f.write jekyll_config |
|
155 |
+ end |
|
156 |
+ mkdir_p "public#{dir}" |
|
157 |
+ end |
|
158 |
+end |
|
159 |
+ |
|
160 |
+desc "Setup _deploy folder and deploy branch" |
|
128 | 161 |
task :config_deploy, :branch do |t, args| |
129 | 162 |
puts "!! Please provide a deploy branch, eg. rake init_deploy[gh-pages] !!" unless args.branch |
130 | 163 |
puts "## Creating a clean #{args.branch} branch in ./#{deploy_dir} for Github pages deployment" |
... | ... |
@@ -1,13 +1,16 @@ |
1 | 1 |
# Require any additional compass plugins here. |
2 | 2 |
project_type = :stand_alone |
3 |
-# Set this to the root of your project when deployed: |
|
3 |
+ |
|
4 |
+# Publishing paths |
|
4 | 5 |
http_path = "/" |
6 |
+http_images_path = "/images" |
|
7 |
+http_fonts_path = "/fonts" |
|
5 | 8 |
css_dir = "public/stylesheets" |
9 |
+ |
|
10 |
+# Local development paths |
|
6 | 11 |
sass_dir = "sass" |
7 | 12 |
images_dir = "source/images" |
8 |
-http_images_dir = "images" |
|
9 | 13 |
fonts_dir = "source/fonts" |
10 |
-http_fonts_dir = "fonts" |
|
11 | 14 |
|
12 | 15 |
line_comments = false |
13 | 16 |
output_style = :compressed |