<%= @item[:title] %>
-
- <% sorted_articles[0..9].each do |article| %>
- <%= render 'article', :article => article %>
- <% end %>
+ <%= yield %>
diff --git a/Rules b/Rules index 5c770db..8057967 100644 --- a/Rules +++ b/Rules @@ -4,13 +4,23 @@ compile '/' do layout 'home' end -compile '/articles/', :rep => :json do +compile '/articles/json/' do filter :erb end +compile '/technical/articles/json/' do + filter :erb +end +compile '/personal/articles/json/' do + filter :erb +end + compile '/articles/' do layout 'articles' end -compile '/*/articles/' do +compile '/technical/articles/' do + layout 'articles' +end +compile '/personal/articles/' do layout 'articles' end @@ -19,11 +29,14 @@ compile '*' do layout 'default' end -route '/articles/', :rep => :json do - item.identifier + 'index.json' +route '/articles/json/' do + item.identifier + 'articles.json' end -route '/articles/' do - item.identifier + 'index.html' +route '/technical/articles/json/' do + item.identifier + 'articles.json' +end +route '/personal/articles/json/' do + item.identifier + 'articles.json' end route '*' do diff --git a/content/articles.yaml b/content/articles.yaml index 36c1c5f..349c365 100644 --- a/content/articles.yaml +++ b/content/articles.yaml @@ -1,2 +1,3 @@ --- title: Articles +body_class: articles \ No newline at end of file diff --git a/content/articles.json b/content/articles/json.json similarity index 65% rename from content/articles.json rename to content/articles/json.json index ce6e07f..5f5af20 100644 --- a/content/articles.json +++ b/content/articles/json.json @@ -1,7 +1,7 @@ <% articles = [] sorted_articles.each do |article| - articles << { :title => article[:title] } + articles << article_to_json(article) end %> <%= articles.to_json %> \ No newline at end of file diff --git a/content/articles/json.yaml b/content/articles/json.yaml new file mode 100644 index 0000000..e521976 --- /dev/null +++ b/content/articles/json.yaml @@ -0,0 +1,2 @@ +--- +title: A New Item diff --git a/content/personal/articles.html b/content/personal/articles.html index b2cbfed..f214efe 100644 --- a/content/personal/articles.html +++ b/content/personal/articles.html @@ -1 +1,3 @@ -Hi, I'm a new item! +<% sorted_articles[0..9].each do |article| %> + <%= render 'article', :article => article %> +<% end %> diff --git a/content/personal/articles/json.json b/content/personal/articles/json.json new file mode 100644 index 0000000..d4267f3 --- /dev/null +++ b/content/personal/articles/json.json @@ -0,0 +1,7 @@ +<% + articles = [] + personal_articles.each do |article| + articles << article_to_json(article) + end +%> +<%= articles.to_json %> \ No newline at end of file diff --git a/content/personal/articles/json.yaml b/content/personal/articles/json.yaml new file mode 100644 index 0000000..e521976 --- /dev/null +++ b/content/personal/articles/json.yaml @@ -0,0 +1,2 @@ +--- +title: A New Item diff --git a/content/technical/articles.html b/content/technical/articles.html index b2cbfed..f214efe 100644 --- a/content/technical/articles.html +++ b/content/technical/articles.html @@ -1 +1,3 @@ -Hi, I'm a new item! +<% sorted_articles[0..9].each do |article| %> + <%= render 'article', :article => article %> +<% end %> diff --git a/content/technical/articles/json.json b/content/technical/articles/json.json new file mode 100644 index 0000000..9ba992b --- /dev/null +++ b/content/technical/articles/json.json @@ -0,0 +1,7 @@ +<% + articles = [] + technical_articles.each do |article| + articles << article_to_json(article) + end +%> +<%= articles.to_json %> \ No newline at end of file diff --git a/content/technical/articles/json.yaml b/content/technical/articles/json.yaml new file mode 100644 index 0000000..e521976 --- /dev/null +++ b/content/technical/articles/json.yaml @@ -0,0 +1,2 @@ +--- +title: A New Item diff --git a/layouts/articles.html b/layouts/articles.html index aacf95b..6b5991c 100644 --- a/layouts/articles.html +++ b/layouts/articles.html @@ -1,12 +1,7 @@
- - -