open current category on root page
parent
c2bf29249c
commit
43151827e2
|
@ -13,4 +13,4 @@ Feel free to comment or [contact][Contact] me directly. There is an [RSS feed][R
|
|||
|
||||
Latest post:
|
||||
|
||||
<%= render "content-embed", :item => @site.items_by_date.last %>
|
||||
<%= render "content-embed", :item => @site.latest_article %>
|
||||
|
|
|
@ -11,4 +11,4 @@ Because death doesn't conquer itself, you know.
|
|||
|
||||
Latest entry:
|
||||
|
||||
<%= render "content-embed", :item => @site.items_by_date.last %>
|
||||
<%= render "content-embed", :item => @site.latest_article %>
|
||||
|
|
|
@ -6,4 +6,4 @@ no_comments: true
|
|||
|
||||
muflax reads stuff and comments on it. Sometimes, quotes out of context.
|
||||
|
||||
<%= render "content-embed", :item => @site.items_by_date.last %>
|
||||
<%= render "content-embed", :item => @site.latest_article %>
|
||||
|
|
|
@ -24,5 +24,5 @@ It's time for a [Bro][PhiloBro]dhisattva to step forward and [reblog][] Buddhist
|
|||
|
||||
Thus have I heard:
|
||||
|
||||
<%= render "content-embed", :item => @site.items_by_date.last %>
|
||||
<%= render "content-embed", :item => @site.latest_article %>
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
<% @site.categories(false).each do |cat| %>
|
||||
<li><%= cat.link true %></li>
|
||||
|
||||
<% if @item.category == cat %>
|
||||
<% if @item.category == cat or (@item.root? and @site.latest_category? cat) %>
|
||||
<ul>
|
||||
<% @site.items_by_date(@item.category).reverse.each do |i| %>
|
||||
<% @site.items_by_date(cat).reverse.each do |i| %>
|
||||
<%= render 'list-item', :item => i, :episteme => false %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -42,6 +42,10 @@ class Nanoc::Item
|
|||
""
|
||||
end
|
||||
end
|
||||
|
||||
def root?
|
||||
self.identifier == "/"
|
||||
end
|
||||
end
|
||||
|
||||
class Category
|
||||
|
@ -132,6 +136,15 @@ class Nanoc::Site
|
|||
def categories all=true
|
||||
@categories.select{|c| c[:not_empty] or all}.map{|c| c[:cat]}
|
||||
end
|
||||
|
||||
def latest_article
|
||||
items_by_date.last
|
||||
end
|
||||
|
||||
# is this category on the main site?
|
||||
def latest_category? cat
|
||||
latest_article.category == cat unless latest_article.nil?
|
||||
end
|
||||
end
|
||||
|
||||
def category name_or_cat
|
||||
|
|
Loading…
Reference in New Issue