From d98cbe21d22e9dced2b0713640319309f0f5c28c Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sun, 10 Mar 2013 18:26:05 -0400 Subject: [PATCH] URL TLC --- config.rb | 20 +++++++++++++++++-- lib/api_docs.rb | 2 +- ... 2012-08-03-ember-1-0-prerelease.markdown} | 0 ...own => 2012-10-25-ember-1-0-pre2.markdown} | 0 ...kdown => 2013-02-15-ember-1-0-rc.markdown} | 0 source/blog/index.html.erb | 12 +++++------ source/blog/{_post.html.erb => post.html.erb} | 0 source/examples/index.html | 1 + source/redirect.html.erb | 8 ++++++++ 9 files changed, 34 insertions(+), 9 deletions(-) rename source/blog/{2012-08-03-ember-1-0-prerelease.html.markdown => 2012-08-03-ember-1-0-prerelease.markdown} (100%) rename source/blog/{2012-10-25-ember-1-0-pre2.html.markdown => 2012-10-25-ember-1-0-pre2.markdown} (100%) rename source/blog/{2013-02-15-ember-1-0-rc.html.markdown => 2013-02-15-ember-1-0-rc.markdown} (100%) rename source/blog/{_post.html.erb => post.html.erb} (100%) create mode 100644 source/redirect.html.erb diff --git a/config.rb b/config.rb index d40bccfa0e..86aeecbb19 100644 --- a/config.rb +++ b/config.rb @@ -27,7 +27,23 @@ activate :blog do |blog| blog.prefix = 'blog' blog.layout = 'layouts/blog' - blog.tag_template = 'blog/tag.html' + blog.tag_template = 'blog/tag' + blog.permalink = '/:year/:month/:day/:title' + blog.taglink = 'tags/:tag' +end + +ready do + blog.articles.each do |article| + options = { + locals: { + redirect_to: article.url + }, + layout: false, + ignore: true + } + + proxy article.path + '.html', 'redirect.html', options + end end page '/blog/feed.xml', layout: false @@ -75,7 +91,7 @@ def rendered_partial_for(key) def link_to_page name, url path = request.path - current = path =~ Regexp.new('^' + url[1..-1] + '.*\.html') + current = path =~ Regexp.new('^' + url[1..-1]) if path == 'index.html' and name == 'about' current = true diff --git a/lib/api_docs.rb b/lib/api_docs.rb index e0b230bd43..2d46224be2 100644 --- a/lib/api_docs.rb +++ b/lib/api_docs.rb @@ -11,7 +11,7 @@ def registered(app, options={}) @repo_url = options[:repo_url] - app.after_configuration do + app.ready do ApiClass.data = data.api page '/api*', directory_index: false, layout: 'layouts/api' diff --git a/source/blog/2012-08-03-ember-1-0-prerelease.html.markdown b/source/blog/2012-08-03-ember-1-0-prerelease.markdown similarity index 100% rename from source/blog/2012-08-03-ember-1-0-prerelease.html.markdown rename to source/blog/2012-08-03-ember-1-0-prerelease.markdown diff --git a/source/blog/2012-10-25-ember-1-0-pre2.html.markdown b/source/blog/2012-10-25-ember-1-0-pre2.markdown similarity index 100% rename from source/blog/2012-10-25-ember-1-0-pre2.html.markdown rename to source/blog/2012-10-25-ember-1-0-pre2.markdown diff --git a/source/blog/2013-02-15-ember-1-0-rc.html.markdown b/source/blog/2013-02-15-ember-1-0-rc.markdown similarity index 100% rename from source/blog/2013-02-15-ember-1-0-rc.html.markdown rename to source/blog/2013-02-15-ember-1-0-rc.markdown diff --git a/source/blog/index.html.erb b/source/blog/index.html.erb index c55b26bf55..4fc490392f 100644 --- a/source/blog/index.html.erb +++ b/source/blog/index.html.erb @@ -5,10 +5,10 @@ title: "Blog" <% partial_for :head, 'head' %> <% partial_for :sidebar, 'sidebar' %> -<% blog.articles.each_with_index do |article, i| %> -
-

<%= link_to article.title, article %> –

- <%= article.summary %> - <%= link_to "Read more...", article %> -
+<% blog.articles.reject(&:proxied_to).each_with_index do |article, i| %> +
+

<%= link_to article.title, article %> –

+ <%= article.summary %> + <%= link_to "Read more...", article %> +
<% end %> diff --git a/source/blog/_post.html.erb b/source/blog/post.html.erb similarity index 100% rename from source/blog/_post.html.erb rename to source/blog/post.html.erb diff --git a/source/examples/index.html b/source/examples/index.html index ef91bd5402..78e6f4fc5a 100644 --- a/source/examples/index.html +++ b/source/examples/index.html @@ -1,3 +1,4 @@ + diff --git a/source/redirect.html.erb b/source/redirect.html.erb new file mode 100644 index 0000000000..335bb10960 --- /dev/null +++ b/source/redirect.html.erb @@ -0,0 +1,8 @@ + + + + + + + +