Skip to content

Commit

Permalink
Hide comments and links to them if site has no comments
Browse files Browse the repository at this point in the history
Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Mar 23, 2014
1 parent dcb7845 commit bbd2818
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/gallery.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
%endfor
</ul>
%endif
%if enable_comments:
%if site_has_comments and enable_comments:
${comments.comment_form(None, permalink, title)}
%endif
</%block>
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="metadata">
<p class="byline author vcard"><span class="byline-name fn">${post.author()}</span></p>
<p class="dateline"><a href="${post.permalink()}" rel="bookmark"><time class="published dt-published" datetime="${post.date.isoformat()}" itemprop="datePublished" title="${messages("Publication date")}">${post.formatted_date(date_format)}</time></a></p>
% if not post.meta('nocomments'):
% if not post.meta('nocomments') and site_has_comments:
<p class="commentline">${comments.comment_link(post.permalink(), post._base_path)}
% endif
</div>
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/post.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
${helper.html_pager(post)}
</nav>
</aside>
% if not post.meta('nocomments'):
% if not post.meta('nocomments') and site_has_comments:
<section class="comments">
<h2>${messages("Comments")}</h2>
${comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/post_header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div class="metadata">
<p class="byline author vcard"><span class="byline-name fn">${post.author()}</span></p>
<p class="dateline"><a href="${post.permalink()}" rel="bookmark"><time class="published dt-published" datetime="${post.date.isoformat()}" itemprop="datePublished" title="${messages("Publication date")}">${post.formatted_date(date_format)}</time></a></p>
% if not post.meta('nocomments'):
% if not post.meta('nocomments') and site_has_comments:
<p class="commentline">${comments.comment_link(post.permalink(), post._base_path)}
% endif
${html_sourcelink()}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/story.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div itemprop="articleBody text">
${post.text()}
</div>
%if enable_comments and not post.meta('nocomments'):
%if site_has_comments and enable_comments and not post.meta('nocomments'):
<section class="comments">
<h2>${messages("Comments")}</h2>
${comments.comment_form(post.permalink(absolute=True), post.title(), post.base_path)}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/bootstrap3/templates/gallery.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</ul>
</noscript>
%endif
%if enable_comments:
%if site_has_comments and enable_comments:
${comments.comment_form(None, permalink, title)}
%endif
</%block>
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/bootstrap3/templates/post.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
${helper.html_pager(post)}
</nav>
</aside>
% if not post.meta('nocomments'):
% if not post.meta('nocomments') and site_has_comments:
<section class="comments">
<h2>${messages("Comments")}</h2>
${comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/bootstrap3/templates/post_header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<div class="metadata">
<p class="byline author vcard"><span class="byline-name fn">${post.author()}</span></p>
<p class="dateline"><a href="${post.permalink()}" rel="bookmark"><time class="published dt-published" datetime="${post.date.isoformat()}" itemprop="datePublished" title="${messages("Publication date")}">${post.formatted_date(date_format)}</time></a></p>
% if not post.meta('nocomments'):
% if not post.meta('nocomments') and site_has_comments:
<p class="commentline">${comments.comment_link(post.permalink(), post._base_path)}
% endif
% if post.meta('link'):
Expand Down
1 change: 1 addition & 0 deletions nikola/nikola.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ def __init__(self, **config):
self._GLOBAL_CONTEXT['search_form'] = self.config.get('SEARCH_FORM')
self._GLOBAL_CONTEXT['comment_system'] = self.config.get('COMMENT_SYSTEM')
self._GLOBAL_CONTEXT['comment_system_id'] = self.config.get('COMMENT_SYSTEM_ID')
self._GLOBAL_CONTEXT['site_has_comments'] = bool(self.config.get('COMMENT_SYSTEM'))
self._GLOBAL_CONTEXT['mathjax_config'] = self.config.get(
'MATHJAX_CONFIG')
self._GLOBAL_CONTEXT['subtheme'] = self.config.get('THEME_REVEAL_CONFIG_SUBTHEME')
Expand Down

0 comments on commit bbd2818

Please sign in to comment.