mirror of
https://github.com/vale981/ablog
synced 2025-03-04 16:51:39 -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.date = date = info['date']
|
||||
self.update = info['update']
|
||||
self.nocomments = info['nocomments']
|
||||
self.published = date and date < TOMORROW
|
||||
self.draft = not self.published
|
||||
self._title = info['title']
|
||||
|
|
|
@ -64,6 +64,7 @@ class PostDirective(Directive):
|
|||
'image': int,
|
||||
'excerpt': int,
|
||||
'exclude': directives.flag,
|
||||
'nocomments': directives.flag,
|
||||
}
|
||||
|
||||
def run(self):
|
||||
|
@ -85,6 +86,7 @@ class PostDirective(Directive):
|
|||
node['image'] = self.options.get('image', None)
|
||||
node['excerpt'] = self.options.get('excerpt', None)
|
||||
node['exclude'] = 'exclude' in self.options
|
||||
node['nocomments'] = 'nocomments' in self.options
|
||||
return [node]
|
||||
|
||||
|
||||
|
@ -337,6 +339,7 @@ def process_posts(app, doctree):
|
|||
'location': node['location'],
|
||||
'language': node['language'],
|
||||
'redirect': node['redirect'],
|
||||
'nocomments': node['nocomments'],
|
||||
'image': node['image'],
|
||||
'exclude': node['exclude'],
|
||||
'doctree': section_copy
|
||||
|
|
|
@ -26,7 +26,11 @@
|
|||
{% if pagename in ablog %}
|
||||
{% include "postnavy.html" %}
|
||||
{% 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">
|
||||
<h2>Comments</h2>
|
||||
<div id="disqus_thread"></div>
|
||||
|
|
|
@ -29,6 +29,7 @@ following directive:
|
|||
:redirect: blog/old-page-name-for-the-post
|
||||
:excerpt: 2
|
||||
:image: 1
|
||||
:nocoments:
|
||||
|
||||
|
||||
**Drafts & Posts**
|
||||
|
@ -68,6 +69,11 @@ following directive:
|
|||
relative to the root folder. The redirect page waits for
|
||||
: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**
|
||||
|
||||
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
|
||||
|
||||
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