The SilverStripe blog module lets you publish blog posts and allow the public to engage with you by commenting on your posts. The module supports flexible categorisation and tagging of blog posts.

From 1.1.0 onwards the blog recipe is included along side the other SilverStripe and CWP recipes by default.

Three levels of permissions are supported:

  • Editors who can control everything in their blog
  • Writers who can create and publish in their blog
  • Contributors who can write, but have limited permissions otherwise

Commenting can be enabled and disabled, and all comments go through a spam filter and then need to be manually moderated before they are published. The module provides an RSS feed to allow the public to subscribe to your blog posts.

Blog CMS

Blog Frontend

Overview

This recipe includes the following modules:

  • Akismet - Implement default spam protection via Akismet service
  • Blog - The main module for providing blogging functionality.
  • Bulk Editing Tools - Supporting module for Comments to allow bulk management of comments
  • Comments - Allows nested page comments
  • Comment Notifications - Supporting module for Comments to notify authors of blog comments
  • Content Widget - Adds additional sidebar widget for HTML content
  • Lumberjack - Supporting module for Blog to allow management of pages via gridfield.
  • Spam Protection - Supporting module for Akismet to provide core spam protection API
  • Widgets - Adds sidebar widgets

Upgrading

While the blog recipe is included by default in all cwp installs from 1.1.0 onwards, this must be manually included in any existing sites if upgrading.

This can be added through the following change to your composer.json:

"require": {
    "cwp/cwp-recipe-basic": "~1.1.0@stable",
    "cwp/cwp-recipe-blog": "~1.1.0@stable",
    "cwp-themes/default": "~1.1.0@stable"
}

For any new project created from 1.1.0 onwards, this recipe can be removed if necessary to omit the above modules from any site. If blogging or comments are not required for a CWP site it's advisable to manually remove this recipe.

Configuration

Any new site created from 1.1.0 onwards will have a set of default configuration options added in order to best customise the blog recipe for cwp defaults. These settings are included in the cwp/cwp-installer module in the blog.yml file under mysite/_config. Sites upgrading from 1.0.7 or below may require one or more of these settings to be manually added.

For configuration of anti-spam please see the Akismet configuration guide for more information.

For the basic configuration, see the default mysite/_config/blog.yml below for reference:

---
Name: mywidgetsconfig
Only:
  moduleexists:
    - silverstripe/blog
    - silverstripe/widgets
---
# Disable if you do not use widgets on your blog {#disable-if-you-do-not-use-widgets-on-your-blog-2}
SilverStripe\Blog\Model\Blog:
  extensions:
    - SilverStripe\Widgets\Extensions\WidgetPageExtension

SilverStripe\Blog\Model\BlogPost:
  extensions:
    - SilverStripe\Widgets\Extensions\WidgetPageExtension

---
Name: myblogconfig
Only:
  moduleexists:
    - silverstripe/blog
    - silverstripe/comments
---
# Enable page comments for blogs and blog posts on the site by default, including frontend moderation / approval {#enable-page-comments-for-blogs-and-blog-posts-on-the-site-by-default-including-frontend-moderation-approval-2}
SilverStripe\Blog\Model\Blog:
  extensions:
    - SilverStripe\Comments\Extensions\CommentsExtension
  comments:
    enabled: false
    frontend_moderation: true
    require_moderation_nonmembers: true
    require_moderation_cms: true
    require_login: false
    require_login_cms: true
    nested_comments: true
    order_comments_by: '"Created" ASC'

SilverStripe\Blog\Model\BlogPost:
  default_notification_template: SilverStripe\CommentNotifications\BlogCommentEmail
  extensions:
    - SilverStripe\Comments\Extensions\CommentsExtension
  comments:
    enabled: true
    frontend_moderation: true
    require_moderation_nonmembers: true
    require_moderation_cms: true
    require_login: false
    require_login_cms: true
    nested_comments: true
    order_comments_by: '"Created" ASC'

---
Name: akismetconfig
Only:
  moduleexists: silverstripe/akismet
---
# Customise your akismet configuration here {#customise-your-akismet-configuration-here-2}
SilverStripe\SiteConfig\SiteConfig:
  extensions:
    - SilverStripe\Akismet\Config\AkismetConfig
# Allows spam posts to be saved for review if necessary {#allows-spam-posts-to-be-saved-for-review-if-necessary-2}
SilverStripe\Akismet\AkismetSpamProtector:
  save_spam: true

---
Name: mycommentspamprotection
Only:
  moduleexists:
    - silverstripe/comments
    - silverstripe/spamprotection
---
# Enable spam protection for comments by default {#enable-spam-protection-for-comments-by-default-2}
SilverStripe\Comments\Controllers\CommentingController:
  extensions:
    - SilverStripe\SpamProtection\Extension\CommentSpamProtection

Was this article helpful?