]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/contrib/postcomment.mdwn
initial comments
[ikiwiki.git] / doc / plugins / contrib / postcomment.mdwn
1 [[!template id=plugin name=postcomment author="[[Simon_McVittie|smcv]]"]]
2 [[!tag type/useful]]
3
4 This plugin adds "blog-style" comments. The intention is that on a non-wiki site
5 (like a blog) you can lock all pages for admin-only access, then allow otherwise
6 unprivileged (or perhaps even anonymous) users to comment on posts.
7
8 Comments are saved as internal pages, so they can never be edited through the CGI,
9 only by direct committers. Currently, comments are always in [[ikiwiki/markdown]].
10
11 > So, why do it this way, instead of using regular wiki pages in a
12 > namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to
13 > limit editing of comments in more powerful ways. --[[Joey]]
14
15 Directives and raw HTML are filtered out by default, and comment authorship should
16 hopefully be unforgeable by CGI users.
17
18 > I'm not sure that raw html should be a problem, as long as the
19 > htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering
20 > out directives, as a special case. --[[Joey]]
21
22 When comments have been enabled generally, you still need to mark which pages
23 can have comments, by including the `\[[!postcomment]]` directive in them. By default,
24 this directive expands to a "post a comment" link plus an `\[[!inline]]` with
25 the comments.
26
27 > I don't like this, because it's hard to explain to someone why they have
28 > to insert this into every post to their blog. Seems that the model used
29 > for discussion pages could work -- if comments are enabled, automatically
30 > add the comment posting form and comments to the end of each page.
31 > --[[Joey]]
32
33 The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use
34 with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from
35 the [[plugins/lockedit]] plugin. Typical usage would be something like:
36
37     locked_pages => "!postcomment(*)"
38
39 to allow non-admin users to comment on pages, but not edit anything. You can also do
40
41     anonok_pages => "postcomment(*)"
42
43 to allow anonymous comments (the IP address will be used as the "author").
44
45 Optional parameters to the postcomment directive:
46
47 * `commit=no`: by default, comments are committed to version control. Use this to
48   disable commits.
49 * `allowhtml=yes`: by default, raw HTML is filtered out. Use this to allow HTML
50   (you should enable [[plugins/htmlscrubber]] and either [[plugins/htmltidy]] or
51   [[plugins/contrib/htmlbalance]] if you do this).
52 * `allowdirectives=yes`: by default, IkiWiki directives are filtered out. Use this
53   to allow directives (avoid enabling any [[plugins/type/slow]] directives if you
54   do this).
55 * `closed=yes`: use this to prevent new comments while still displaying existing ones.
56 * `atom`, `rss`, `feeds`, `feedshow`, `timeformat`, `feedonly`: the same as for [[plugins/inline]]
57
58 This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]",
59 and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk.
60
61 Known issues:
62
63 * Needs code review
64 * The access control via postcomment() is rather strange
65 * There is some common code cargo-culted from other plugins (notably inline and editpage) which
66   should probably be shared
67 * If the postcomment directive is removed from a page, comments can still be made on that page,
68   and will be committed but not displayed; to disable comments properly you have to set the
69   closed="yes" directive parameter (and refresh the wiki), *then* remove the directive if
70   desired
71
72 > I haven't done a detailed code review, but I will say I'm pleased you
73 > avoided re-implementing inline! --[[Joey]]