1 ## Syndication autodiscovery for comment feeds
3 A standard `\[[!inline]]` directive adds links to the autogenerated syndication feeds using link tags in the header:
5 <link rel="alternate" type="application/rss+xml" title="$title" href="$page.atom" />
6 <link rel="alternate" type="application/atom+xml" title="$title" href="$page.atom" />
8 These links aren't added to my pages that include comments even though comments generate syndication feeds. How can I configure the comments plugin to add these links to the header? (These links are required for user-agent autodiscovery of syndication feeds.) --[[anderbubble]]
10 ## Moderating comments from the CLI
12 How do you do this, without using the UI in the Preferences?
14 Please put this info on the page. Many thanks --[[Kai Hendry]]
16 ## Why internal pages? (unresolved)
18 Comments are saved as internal pages, so they can never be edited through the CGI,
19 only by direct committers.
21 > So, why do it this way, instead of using regular wiki pages in a
22 > namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to
23 > limit editing of comments in more powerful ways. --[[Joey]]
25 >> Er... I suppose so. I'd assumed that these pages ought to only exist as inlines
26 >> rather than as individual pages (same reasoning as aggregated posts), though.
28 >> lockedit is actually somewhat insufficient, since `check_canedit()`
29 >> doesn't distinguish between creation and editing; I'd have to continue to use
30 >> some sort of odd hack to allow creation but not editing.
32 >> I also can't think of any circumstance where you'd want a user other than
33 >> admins (~= git committers) and possibly the commenter (who we can't check for
34 >> at the moment anyway, I don't think?) to be able to edit comments - I think
35 >> user expectations for something that looks like ordinary blog comments are
36 >> likely to include "others can't put words into my mouth".
38 >> My other objection to using a namespace is that I'm not particularly happy about
39 >> plugins consuming arbitrary pieces of the wiki namespace - /discussion is bad
40 >> enough already. Indeed, this very page would accidentally get matched by rules
41 >> aiming to control comment-posting... :-) --[[smcv]]
43 >>> Thinking about it, perhaps one way to address this would be to have the suffix
44 >>> (e.g. whether commenting on Sandbox creates sandbox/comment1 or sandbox/c1 or
45 >>> what) be configurable by the wiki admin, in the same way that recentchanges has
46 >>> recentchangespage => 'recentchanges'? I'd like to see fewer hard-coded page
47 >>> names in general, really - it seems odd to me that shortcuts and smileys
48 >>> hard-code the name of the page to look at. Perhaps I could add
49 >>> discussionpage => 'discussion' too? --[[smcv]]
51 >>> (I've now implemented this in my branch. --[[smcv]])
53 >> The best reason to keep the pages internal seems to me to be that you
54 >> don't want the overhead of every comment spawning its own wiki page. --[[Joey]]
58 The plugin now allows multiple comment formats while still using internal
59 pages; each comment is saved as a page containing one `\[[!comment]]` directive,
60 which has a superset of the functionality of [[ikiwiki/directives/format]].
62 ## Access control (unresolved?)
64 By the way, I think that who can post comments should be controllable by
65 the existing plugins opendiscussion, anonok, signinedit, and lockedit. Allowing
66 posting comments w/o any login, while a nice capability, can lead to
67 spam problems. So, use `check_canedit` as at least a first-level check?
70 > This plugin already uses `check_canedit`, but that function doesn't have a concept
71 > of different actions. The hack I use is that when a user comments on, say, sandbox,
72 > I call `check_canedit` for the pseudo-page "sandbox[postcomment]". The
73 > special `postcomment(glob)` [[ikiwiki/pagespec]] returns true if the page ends with
74 > "[postcomment]" and the part before (e.g. sandbox) matches the glob. So, you can
75 > have postcomment(blog/*) or something. (Perhaps instead of taking a glob, postcomment
76 > should take a pagespec, so you can have postcomment(link(tags/commentable))?)
78 > This is why `anonok_pagespec => 'postcomment(*)'` and `locked_pages => '!postcomment(*)'`
79 > are necessary to allow anonymous and logged-in editing (respectively).
81 >> I changed that to move the flag out of the page name, and into a variable that the `match_postcomment`
82 >> function checks for. Other ugliness still applies. :-) --[[Joey]]
84 > This is ugly - one alternative would be to add `check_permission()` that takes a
85 > page and a verb (create, edit, rename, remove and maybe comment are the ones I
86 > can think of so far), use that, and port the plugins you mentioned to use that
87 > API too. This plugin could either call `check_can("$page/comment1", 'create')` or
88 > call `check_can($page, 'comment')`.
90 > One odd effect of the code structure I've used is that we check for the ability to
91 > create the page before we actually know what page name we're going to use - when
92 > posting the comment I just increment a number until I reach an unused one - so
93 > either the code needs restructuring, or the permission check for 'create' would
94 > always be for 'comment1' and never 'comment123'. --[[smcv]]
96 >> Now resolved, in fact --[[smcv]]
98 > Another possibility is to just check for permission to edit (e.g.) `sandbox/comment1`.
99 > However, this makes the "comments can only be created, not edited" feature completely
100 > reliant on the fact that internal pages can't be edited. Perhaps there should be a
101 > `editable_pages` pagespec, defaulting to `'*'`? --[[smcv]]
103 ## comments directive vs global setting (resolved?)
105 When comments have been enabled generally, you still need to mark which pages
106 can have comments, by including the `\[[!comments]]` directive in them. By default,
107 this directive expands to a "post a comment" link plus an `\[[!inline]]` with
108 the comments. [This requirement has now been removed --[[smcv]]]
110 > I don't like this, because it's hard to explain to someone why they have
111 > to insert this into every post to their blog. Seems that the model used
112 > for discussion pages could work -- if comments are enabled, automatically
113 > add the comment posting form and comments to the end of each page.
116 >> I don't think I'd want comments on *every* page (particularly, not the
117 >> front page). Perhaps a pagespec in the setup file, where the default is "*"?
118 >> Then control freaks like me could use "link(tags/comments)" and tag pages
119 >> as allowing comments.
121 >>> Yes, I think a pagespec is the way to go. --[[Joey]]
123 >>>> Implemented --[[smcv]]
126 >> The model used for discussion pages does require patching the existing
127 >> page template, which I was trying to avoid - I'm not convinced that having
128 >> every possible feature hard-coded there really scales (and obviously it's
129 >> rather annoying while this plugin is on a branch). --[[smcv]]
131 >>> Using the template would allow customising the html around the comments
132 >>> which seems like a good thing? --[[Joey]]
134 >>>> The \[[!comments]] directive is already template-friendly - it expands to
135 >>>> the contents of the template `comments_embed.tmpl`, possibly with the
136 >>>> result of an \[[!inline]] appended. I should change `comments_embed.tmpl`
137 >>>> so it uses a template variable `INLINE` for the inline result rather than
138 >>>> having the perl code concatenate it, which would allow a bit more
139 >>>> customization (whether the "post" link was before or after the inline).
140 >>>> Even if you want comments in page.tmpl, keeping the separate comments_embed.tmpl
141 >>>> and having a `COMMENTS` variable in page.tmpl might be the way forward,
142 >>>> since the smaller each templates is, the easier it will be for users
143 >>>> to maintain a patched set of templates. (I think so, anyway, based on what happens
144 >>>> with dpkg prompts in Debian packages with monolithic vs split
145 >>>> conffiles.) --[[smcv]]
147 >>>>> I've switched my branch to use page.tmpl instead; see what you think? --[[smcv]]
149 ## Raw HTML (resolved?)
151 Raw HTML was not initially allowed by default (this was configurable).
153 > I'm not sure that raw html should be a problem, as long as the
154 > htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering
155 > out directives, as a special case. --[[Joey]]
157 >> Right, if I sanitize each post individually, with htmlscrubber and either htmltidy
158 >> or htmlbalance turned on, then there should be no way the user can forge a comment;
159 >> I was initially wary of allowing meta directives, but I think those are OK, as long
160 >> as the comment template puts the \[[!meta author]] at the *end*. Disallowing
161 >> directives is more a way to avoid commenters causing expensive processing than
162 >> anything else, at this point.
164 >> I've rebased the plugin on master, made it sanitize individual posts' content
165 >> and removed the option to disallow raw HTML. Sanitizing individual posts before
166 >> they've been htmlized required me to preserve whitespace in the htmlbalance
167 >> plugin, so I did that. Alternatively, we could htmlize immediately and always
168 >> save out raw HTML? --[[smcv]]
170 >>> There might be some use cases for other directives, such as img, in
173 >>> I don't know if meta is "safe" (ie, guaranteed to be inexpensive and not
174 >>> allow users to do annoying things) or if it will continue to be in the
175 >>> future. Hard to predict really, all that can be said with certainty is
176 >>> all directives will contine to be inexpensive and safe enough that it's
177 >>> sensible to allow users to (ab)use them on open wikis.
182 I have a test ikiwiki setup somewhere to investigate adopting the comments
183 plugin. It is setup with no auth enabled and I got hammered with a spam attack
184 over the last weekend (predictably). What surprised me was the scale of the
185 attack: ikiwiki eventually triggered OOM and brought the box down. When I got
186 it back up, I checked out a copy of the underlying git repository, and it
187 measured 280M in size after being packed. Of that, about 300K was data prior
188 to the spam attack, so the rest was entirely spam text, compressed via git's
189 efficient delta compression.
191 I had two thoughts about possible improvements to the comments plugin in the
194 * comment pagination - there is a hard-to-define upper limit on the number
195 of comments that can be appended to a wiki page whilst the page remains
196 legible. It would be useful if comments could be paginated into sub-pages.
198 * crude flood control - asides from spam attacks (and I am aware of
199 [[plugins/blogspam]]), people can crap flood or just aggressively flame
200 repeatedly. An interesting prevention measure might be to not let an IP
201 post more than 3 sequential comments to a page, or to the site, without
202 at least one other comment being interleaved. I say 3 rather than 2 since
203 correction follow-ups are common.
212 Any thoughts about implementing some simple threading in the comments?
214 Or at least a reply functionality that quotes the subject/contents?
220 ## Disabling certain formats for comments
222 It seems that comments plugin allows using all enabled formats and
223 there is not way to disable some of them. For my blog, I want to use
224 additional formats for writing posts but I do not want commenters to
225 use those formats because it would be a security problem.
227 Any suggestions or hints how to implement this?