As I said the blog comments are added using Cookbook:CommentBoxStyled. I decided to use a seperate BlogComments group for them and use the blog page name for each comment page. But how tie it together?
A blog comments page is included in the blog page via an include in the BlogPages.GroupFooter. This Group footer also adds a "Comment" button which when clicked opens a new comment page:
====
!!!Comments:
(:include BlogComments.{$Name}:)
[[<<]]
>>center<<
(:input form action={$PageUrl} method=post:)
(:input hidden n "BlogComments.{$Name}":)
(:input hidden action newtopic:)
(:input submit post "Comment" class='inputbutton':)
(:input end:)
>><<
And in order to have the blog page displayed when one is on the comments page, it needs to be included at the top. The BlogComments.GroupHeader is doing that:
(:include BlogPages.{$Name}:)(:nogroup:)
====
!!!Comments
(:nogroup:)] suppresses the group link in the titlebar, part of TriadSkin's features.
These mechanisms tie the blog page and comment page together, and prevent the comments from showing in the main blog homepage, or any archive or category page. This is a neat byproduct of using group footer/ group header: an (:include:) here includes a page if you are in the group. But if the page is included somewhere else, for instance via a blog list on a page in the blog group, then it is shown without any further (via group footer included) comment page.
To link to comment from there it needed a link in the pagelist template BlogListTemplates#blog. It shows a link to the blog page if a comments page exists. Otherwise it shows a button which when clicked will take you to a new comments page, ready to post a comment. I had to make this a button, a simple link does not work.
Finally, the BlogComments.GroupFooter contains the comment box:
[[<<]](:title {$BlogTitle}:)
>>center<<
(:input form name=cboxform action={$PageUrl} method=post:)
(:input hidden n {$FullName}:)
(:input hidden action comment:)
(:input hidden order chrono:)'''Your Comment:'''[[<<]]
(:input textarea text rows=7 cols=50 class=inputtext:)[[<<]]
Author: (:input text author {$Author} class='inputbox':)\
(:input submit post Post class='inputbutton':)\
(:input reset reset Reset class='inputbutton':)(:input end:)
>><<
----
Back to [[BlogPages/{$Name}|{$BlogTitle}]]\
-- [[Blog.Blog| Blog Home Page]]
It also has a title markup, which makes sure the blog page shows the correct title and is not overridden by a title of the included comments page.
Comments:
Back to Blog Comments -- Blog Home Page
