Skip to content

Commit ee30344

Browse files
committed
improved blog layout
1 parent a605e2a commit ee30344

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

Rules

+11-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,19 @@ compile '/blog/*' do
3737
layout 'blog'
3838
end
3939

40+
compile '/blog/*/' do
41+
filter :erb
42+
filter :rdiscount
43+
filter :auto_ids
44+
filter :pre_code
45+
layout 'blog'
46+
end
47+
48+
# TODO for nanoc 3.8:
49+
# route %r</blog/([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)> do |y, m, d, slug|
4050
blog_regexp = %r</blog/([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)>
4151
route blog_regexp do
42-
y,m,d,slug = blog_regexp.match(item.identifier)[1..-1]
43-
52+
y, m, d, slug = blog_regexp.match(item.identifier).captures
4453
"/blog/#{y}/#{m}/#{slug}/index.html"
4554
end
4655

content/blog.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
---
2-
title: RVM Blog
3-
---
4-
5-
<%= sorted_articles.first.compiled_content %>
1+
<% item = sorted_articles.first %>

layouts/blog.haml

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@
1313

1414
#content
1515
%a{ :name => "top" }
16-
=yield
16+
%h1
17+
= item[:title]
18+
%aside
19+
Posted at:
20+
= item[:created_at]
21+
%article
22+
=yield
1723
%a{ :name => "bottom" }
1824

19-
=render "shared/blog"
25+
=render "shared/blog_menu"
2026

2127
=render "shared/footer"

layouts/default.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
=yield
1717
%a{ :name => "bottom" }
1818

19-
=render "shared/doc"
19+
=render "shared/doc_menu"
2020

2121
=render "shared/footer"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)