Added 404, moved archives from /blog/archives to /archives, added migration in update_source rake task. Closes #375

This commit is contained in:
Brandon Mathis 2012-05-20 22:23:18 -05:00
parent a49651fdfd
commit 741107291b
5 changed files with 18 additions and 5 deletions

View File

@ -0,0 +1,8 @@
---
layout: page
title: Page Not Found
---
Oops, I couldnt find that page! Sorry about that.
Maybe try the search box (top right), or look through the [archives](/archives)?

View File

@ -1,4 +1,4 @@
<ul class="main-navigation">
<li><a href="{{ root_url }}/">Blog</a></li>
<li><a href="{{ root_url }}/blog/archives">Archives</a></li>
<li><a href="{{ root_url }}/archives">Archives</a></li>
</ul>

View File

@ -13,7 +13,7 @@ layout: default
{% if paginator.next_page %}
<a class="prev" href="{{paginator.next_page}}">&larr; Older</a>
{% endif %}
<a href="/blog/archives">Blog Archives</a>
<a href="/archives">Blog Archives</a>
{% if paginator.previous_page %}
<a class="next" href="{{paginator.previous_page}}">Newer &rarr;</a>
{% endif %}

View File

@ -200,9 +200,14 @@ task :update_source, :theme do |t, args|
cp "#{source_dir}.old/favicon.png", source_dir
mv "#{source_dir}/index.html", "#{blog_index_dir}", :force=>true if blog_index_dir != source_dir
cp "#{source_dir}.old/index.html", source_dir if blog_index_dir != source_dir && File.exists?("#{source_dir}.old/index.html")
if File.exists?("#{source_dir}/archives/index.html")
rm "#{source_dir}/archives/index.html"
mv "#{source_dir}/blog/archives/index.html", "#{source_dir}/archives/index.html"
if File.exists?("#{source_dir}/blog/archives/index.html")
puts "## Moving blog/archives to /archives (standard location as of 2.1) ##"
file = "#{source_dir}/_includes/custom/navigation.html"
navigation = IO.read(file)
navigation = navigation.gsub(/(.*)\/blog(\/archives)(.*$)/m, '\1\2\3')
File.open(file, 'w') do |f|
f.write navigation
end
rm_r "#{source_dir}/blog/archives"
rm_r "#{source_dir}/blog" if Dir.entries("#{source_dir}/blog").join == "..."
end