You are here: System » BlogPlugin


A blogging system for Foswiki

This plugin comes as a WikiApp to run a weblog using Foswiki. Based on the WikiWorkbench approach, it may be used to instantiate as many blogs as you like on the same Foswiki site.




%STARTSECTION{"screenshots"}%<div class="screenshots">
  <a href="%ATTACHURLPATH%/BlogPluginSnap1.png"><img src="%ATTACHURLPATH%/BlogPluginSnap1.png" width="150" alt="snap1" /></a>
  <a href="%ATTACHURLPATH%/BlogPluginSnap2.png"><img src="%ATTACHURLPATH%/BlogPluginSnap2.png" width="150" alt="snap2" /></a>
  <a href="%ATTACHURLPATH%/BlogPluginSnap3.png"><img src="%ATTACHURLPATH%/BlogPluginSnap3.png" width="150" alt="snap3" /></a>
  <a href="%ATTACHURLPATH%/BlogPluginSnap4.png"><img src="%ATTACHURLPATH%/BlogPluginSnap4.png" width="150" alt="snap4" /></a>
  <a href="%ATTACHURLPATH%/BlogPluginSnap5.png"><img src="%ATTACHURLPATH%/BlogPluginSnap5.png" width="150" alt="snap5" /></a>
  <a href="%ATTACHURLPATH%/BlogPluginSnap6.png"><img src="%ATTACHURLPATH%/BlogPluginSnap6.png" width="150" alt="snap6" /></a>

.screenshots a {
  margin:0 2px 2px;

Getting started

To create a new blog use the WebCreateNewWeb tool and select the _BlogTemplate template. This will create a new web by copying the content of the _BlogTemplate web into the new target web.

Now check the WebPreferences of this newly created web and review its settings, i.e. the access rights for the web.

Make sure you add a nice description of your blog in the WEBSUMMARY preference setting.

Create a new posting by clicking on BlogEntries on the sidebar. This will list all existing blog entries, as well as a form to create a new one.

Note that your posting will not be publicly visible unless you switched its State property to published.

Importing WordPress Content

BlogPlugin comes with a conversion tool to convert a WXR, the native way of WordPress to export its data to an XML file, into Foswiki content. This content will then make up a new web that you can run using this plugin. I.e. it will extract all tags and categories as well as comments.

The basic command to do so is:

cd <foswiki-dir>/bin
./rest /BlogPlugin/importWordPress ... param=value ... 

The importWordPress REST handler takes a couple of parameters, most imporantly the name of the XML file holding the blog data. It can either convert all of the data or just one blog posting given its ID.

Parameter Description
file path to the WXR file
id ID of a single blog posting to convert; by default all postings are converted
target name of a web to be created
override boolean flag weather to override the target web if it already exists
template template web to be used, defaults to _BlogTemplate
dry boolean flag to switch on/off real operations; you might want to test conversion first by enabling this flag

During conversion of postings a list of "downloadables" is collected and then fetched dynamically from the current WordPress site. This is foremost any images being used in postings.

There are a couple of features that are currently not converted to its Foswiki equivalent:

These WordPress macros will stay as they are in the text of a posting and will have to be fixed manually by now.

URLs of blog postings are created based on their title: spaces are removed and remaining words are concatenated forming a proper WikiWord. Any converted topic will contain the original URL of its WordPress as a comment at the end of the text. In case you'd like to replace the previous WordPress blog with Foswiki you may use the createRedirectMap to create a map of URLs used by the web server underneath to redirect old WordPress URLs to new Foswiki URLs.

Bulk-redirects from WordPress to Foswiki URLs

cd <foswiki-dir>/bin
./rest /BlogPlugin/createRedirectMap ... param=value ...

Parameters resemble those of the importWordPress REST handler as it operates on the same WXR file.

Parameter Description
file path to the WXR file
id ID of a single blog posting to create a redirect for
target name of the web holding the new Foswiki blog
path (optional) view path to blog postings, defaults to $Foswiki::cfg{ScriptUrlPaths}{view}
| format | specify the output format, can be nginx or apache (default)

Note for now the format of the resulting redirect map is only valid for Nginx out of the box. The output will look like this:

For apache (default):

RewriteRule /foswiki-patch-release-1-1-10/ /bin/view/Blog/FoswikiPatchRelease1110 [R=301,L]
RewriteRule /translations-needed-for-foswiki-2-1/ /bin/view/Blog/TranslationsNeededForFoswiki21 [R=301,L]
RewriteRule /foswiki-2-1-beta-available-for-testing/ /bin/view/Blog/Foswiki21BetaIsAvailableForTesting [R=301,L]
RewriteRule /foswiki-2-1-released/ /bin/view/Blog/Foswiki21HasBeenReleased [R=301,L]
RewriteRule /foswiki-2-1-2-available/ /bin/view/Blog/Foswiki212Available [R=301,L]

Store the result in /etc/apache2/conf-enabled/foswiki-blog-redirects.conf or the like to make sure it is included by apache.

For nginx:

~*/foswiki-patch-release-1-1-10/? /bin/view/Blog/FoswikiPatchRelease1110;
~*/translations-needed-for-foswiki-2-1/? /bin/view/Blog/TranslationsNeededForFoswiki21;
~*/foswiki-2-1-beta-available-for-testing/? /bin/view/Blog/Foswiki21BetaIsAvailableForTesting;
~*/foswiki-2-1-released/? /bin/view/Blog/Foswiki21HasBeenReleased;
~*/foswiki-2-1-2-available/? /bin/view/Blog/Foswiki212Available;

Store the result in /etc/nginx/ and add a rule such as

map $uri $redirect_uri {
   include /etc/nginx/;

to your nginx global site settings.

Automatic publishing / unpublishing blog postings

Each posting has got three valus that specify whether it is visible to the outside (published) or not (unpublished). Unpublished blog postings will have according access control rules set automatically to hide them from public access.

Field Description
State possible values are published, unpublished: only blog entries in state published are readable by other users; unpublished blog entries are only visible for the authors of this blog entry
Publish Date only blog entries in state published are readable by other users; unpublished blog entries are only visible for the authors of this blog entry
Unpublish Date only blog entries in state published are readable by other users; unpublished blog entries are only visible for the authors of this blog entry

Automatic publishing is controled by the publish REST handler called regularly by a cron job such as:

0 0 * * * cd <foswiki-dir>/bin && ./rest/BlogPlugin/publish

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -> "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button. Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will not show up in the search results.

You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See for more help.



Change History

02 May 2019: major rewrite based on new WikiWorkbench and ClassificationPlugin
23 Jan 2017: improved compatibility with PatternSkin; using date2 instead of date formfield now; improved OpenGraph meta data in blog postings; disabled HyphenateContrib by default now due to typography issues; fixed calculation of comments; fixed rendering of breadcrumbs; fixed solr-based blog search; display type hierarchy on CompleteDocumentation now; improvements to FrontPageViewTemplate, RenderArchives, RenderBlogEntries, RenderBlogEntryPagination, RenderBlogEntryTitle, RenderRecentBlogEntries, RenderSimilarBlogEntries; improvements to rss and atom feeds, i.e. make them cacheable by default; new WordPress importer; index a publishdate property for dbcache entries; added new default WebLexicon feature part of latest WikiWorkbench and MultiLingualPlugin; added SeoTopic to blog template to be able to create seo pages that aren't necessarily a blog posting; added translation files for almost all supported languages, still low coverage
27 Nov 2014: added publish/unpublish feature
15 Apr 2014: improved topic info layout
04 Apr 2014: flag rest handlers that don't require authentication
18 Mar 2014: improve css of headings
07 Nov 2013: rewrite migrating most features to other Foswiki plugins
24 Jan 2006: initial version

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding AustLII Communities? Send feedback
This website is using cookies. More info. That's Fine