Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
3 posts Page 1 of 1
Here's some tips to be able to turn disqus comments on or off for each page of a blog template.

You may be tempted to try using "commentable=1" in your "template" tag, in order to be able to use the "k_is_commentable" variable to show the comments block (or not). That is convenient because the admin panel will automatically contain a setting for the user to turn comments off for a given page.

However, this solution is defective, because by setting "commentable=1" you activate the couchcms comments system and allow it to accept spam comments from robot submitters. This can happen even if there is no visible comment entry form on your pages.

The solution (one solution) is to turn "commentable" off for the template ("commentable=0", or remove the commentable property). Then use a editable field to control display of comments.

Following are some snippets from my own site:

inside the "template" tag, define an editable field and set a default. Also provide a description to appear in the Admin panel for the field:
Code: Select all
<cms:editable name='comments' type='text' order='4' desc='Set to "off" to disable comments for this page'>on</cms:editable>


Optional: To show commentable status for all pages in the admin panel list of blog entries, use a custom config_list_view. Here is what I use:
Code: Select all
<cms:config_list_view orderby='weight' order='asc'>
      <cms:field 'k_selector_checkbox' />
      <cms:field 'k_page_title' sortable='0' />
      <cms:field 'comments' header='Disqus Comments' >
         <cms:if comments != 'off' >
             <cms:show "on"/>
         <cms:else />
             <cms:show "off"/>
         </cms:if >
      </cms:field >
      <cms:field 'k_page_foldertitle' />
      <cms:field 'k_up_down' />
      <cms:field 'k_actions' />
</cms:config_list_view>


And to show the Disqus comments, use something like this in your template's page view:

Code: Select all
<cms:if comments!='off' >
(disqus comment stuff here)
</cms:if >


Remember to load the blog page while logged in as admin to activate the changes.
Thanks, good idea ... although I would use a drop-down or a radio in the admin to conditionally display it hide the Discuss stuff, sounds a bit more convenient to me.

Also, can anyone else corroborate the spammy posts threat? I have tested both the Couch and the Discuss comments and see advantages in either. Could not quite compare disadvantages, tho.
@MiB, there is a thread about fighting spam. To recap all methods that I remember, there are various techniques - a honeypot, a captcha, a question-answer box, a throttle and a stopforumspam.com approaches available in CouchCMS.
3 posts Page 1 of 1