simplify comment inclusion

master
muflax 2012-06-17 20:17:41 +02:00
parent cf632eb6b5
commit 85632333ee
2 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<!-- comments -->
<% unless @item[:no_comments] or @item[:is_category] %>
<% if @item.comments? or @site.comments? %>
<div id="disqus">
<div id="disqus_thread"></div>
<script type="text/javascript">

View File

@ -46,6 +46,10 @@ class Nanoc::Item
def root?
self.identifier == "/"
end
def comments?
!(self[:no_comments] or self[:is_category])
end
end
class Category
@ -165,6 +169,10 @@ class Nanoc::Site
items[index + 1]
end
end
def comments?
!self["disqus_site"].nil?
end
end
def category name_or_cat