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:
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:
And to show the Disqus comments, use something like this in your template's page view:
Remember to load the blog page while logged in as admin to activate the changes.
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.