mirror of
https://github.com/vale981/ablog
synced 2025-03-05 09:11:38 -05:00
Merge pull request #64 from ninmesara/devel
Disable comments for the current post
This commit is contained in:
commit
345b2ef4e7
4 changed files with 16 additions and 2 deletions
|
@ -329,6 +329,7 @@ class Post(BlogPageMixin):
|
||||||
self.order = info['order']
|
self.order = info['order']
|
||||||
self.date = date = info['date']
|
self.date = date = info['date']
|
||||||
self.update = info['update']
|
self.update = info['update']
|
||||||
|
self.nocomments = info['nocomments']
|
||||||
self.published = date and date < TOMORROW
|
self.published = date and date < TOMORROW
|
||||||
self.draft = not self.published
|
self.draft = not self.published
|
||||||
self._title = info['title']
|
self._title = info['title']
|
||||||
|
|
|
@ -64,6 +64,7 @@ class PostDirective(Directive):
|
||||||
'image': int,
|
'image': int,
|
||||||
'excerpt': int,
|
'excerpt': int,
|
||||||
'exclude': directives.flag,
|
'exclude': directives.flag,
|
||||||
|
'nocomments': directives.flag,
|
||||||
}
|
}
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
@ -85,6 +86,7 @@ class PostDirective(Directive):
|
||||||
node['image'] = self.options.get('image', None)
|
node['image'] = self.options.get('image', None)
|
||||||
node['excerpt'] = self.options.get('excerpt', None)
|
node['excerpt'] = self.options.get('excerpt', None)
|
||||||
node['exclude'] = 'exclude' in self.options
|
node['exclude'] = 'exclude' in self.options
|
||||||
|
node['nocomments'] = 'nocomments' in self.options
|
||||||
return [node]
|
return [node]
|
||||||
|
|
||||||
|
|
||||||
|
@ -337,6 +339,7 @@ def process_posts(app, doctree):
|
||||||
'location': node['location'],
|
'location': node['location'],
|
||||||
'language': node['language'],
|
'language': node['language'],
|
||||||
'redirect': node['redirect'],
|
'redirect': node['redirect'],
|
||||||
|
'nocomments': node['nocomments'],
|
||||||
'image': node['image'],
|
'image': node['image'],
|
||||||
'exclude': node['exclude'],
|
'exclude': node['exclude'],
|
||||||
'doctree': section_copy
|
'doctree': section_copy
|
||||||
|
|
|
@ -26,7 +26,11 @@
|
||||||
{% if pagename in ablog %}
|
{% if pagename in ablog %}
|
||||||
{% include "postnavy.html" %}
|
{% include "postnavy.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ablog.disqus_shortname and ablog.blog_baseurl and ((pagename in ablog and (ablog[pagename].published or ablog.disqus_drafts)) or (not pagename in ablog and ablog.disqus_pages)) %}
|
{% if ablog.disqus_shortname and ablog.blog_baseurl and
|
||||||
|
(not ablog[pagename].nocomments) and
|
||||||
|
((pagename in ablog and (ablog[pagename].published or
|
||||||
|
ablog.disqus_drafts)) or
|
||||||
|
(not pagename in ablog and ablog.disqus_pages)) %}
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2>Comments</h2>
|
<h2>Comments</h2>
|
||||||
<div id="disqus_thread"></div>
|
<div id="disqus_thread"></div>
|
||||||
|
|
|
@ -29,6 +29,7 @@ following directive:
|
||||||
:redirect: blog/old-page-name-for-the-post
|
:redirect: blog/old-page-name-for-the-post
|
||||||
:excerpt: 2
|
:excerpt: 2
|
||||||
:image: 1
|
:image: 1
|
||||||
|
:nocoments:
|
||||||
|
|
||||||
|
|
||||||
**Drafts & Posts**
|
**Drafts & Posts**
|
||||||
|
@ -68,6 +69,11 @@ following directive:
|
||||||
relative to the root folder. The redirect page waits for
|
relative to the root folder. The redirect page waits for
|
||||||
:confval:`post_redirect_refresh` seconds before redirection occurs.
|
:confval:`post_redirect_refresh` seconds before redirection occurs.
|
||||||
|
|
||||||
|
**Disable comments**
|
||||||
|
|
||||||
|
You can disable comments for the current post using the ``:nocomments:``
|
||||||
|
option. Currently there is no way to disable comments in a specific page.
|
||||||
|
|
||||||
**Excerpts & Images**
|
**Excerpts & Images**
|
||||||
|
|
||||||
By default, ABlog uses the first paragraph of a page as post excerpt.
|
By default, ABlog uses the first paragraph of a page as post excerpt.
|
||||||
|
@ -188,4 +194,4 @@ A list of posts can be displayed in any page using the following directive:
|
||||||
.. update:: Apr 14, 2015
|
.. update:: Apr 14, 2015
|
||||||
|
|
||||||
Added ``:list-style:`` option to :rst:dir:`postlist` to control bullet
|
Added ``:list-style:`` option to :rst:dir:`postlist` to control bullet
|
||||||
list style. *circle*, *disk*, and *none* (default) are recognized.
|
list style. *circle*, *disk*, and *none* (default) are recognized.
|
||||||
|
|
Loading…
Add table
Reference in a new issue