Blog Plugin

blog plugin by Gina Häußge, Michael Klier
Use DokuWiki as blogging tool. (previous authors: Esther Brunner)

Last updated on 2009-05-12. Provides Syntax, Helper, Action.
Compatible with DokuWiki 2009-02-14, 2008-05-05.

Requires include, pagelist.
Similar to bliki, blogtng, content.

Tagged with blog, blogging, news.

Download

Download plugin-blog.tgz
BundleHub Configure your own DokuWiki blogsuite install package, consisting of all mandatory plugins plus any optional features you want to include:
BlogSuite BundleHub
Tips If you intend to use this plugin be sure to take a look at the blogging tips page

Description

The Blog Plugin makes blogs in your wiki easily possible. The blog component shows the latest entries (pages) from a namespace in reverse chronological order. In this new version, the creation date is the sort key – no longer the date of the last non-minor modification as in previous versions. The archive component lists all entries that were written (created) in the given month.

If you use this plugin for blogging you might want to join Planet DokuWiki.

Configuration

The blog plugin can be configured using the DokuWiki configuration manager available in the admin menu.

namespace The default namespace which is used if no namespace was given in the syntax
formposition You can choose to display the new entry form either above or below the blog entries
dateprefix A date prefix that automatically gets added to pages created with the new entry form. You can use the options from the strftime PHP function; namespace separators work as well, e.g. %Y:%m%d
sortkey Defines how the blog entries are sorted. Available options are creation date, modification date, page name, page ID and page title (first headline)
sortorder Sort the blog entries ascending/descending

Components

Blog

{{blog>[namespace]?[number]&[flags]}}
[namespace] namespace for the blog; subspaces will be searched as well; * is the whole wiki, . is the same namespace as the page lies in optional; default is the blog namespace set in the configuration
[number] number of entries to show per page optional; default is 5
[flags] include flags delimited by &, see flags optional

This includes a specified number of most recent blog entries from the given namespace into the current page. Below the entries a link to the page (permalink), the author, the creation date and the number of comments are shown. Link, author, date and comments info can be hidden. At the end of the blog a link to older entries lets you navigate in the history of the blog. At the very end, if you have enough rights to create new pages, a form for new blog entries is displayed.

Archive

{{archive>[namespace]?[month]&[flags]}}
[namespace] the namespace for which you want an archive list; * is the whole wiki, . is the same namespace as the page lies in optional; default is the namespace specified in the configuration
[month] the month for the archive list in YYYY-MM format; * for all pages required
[flags] pagelist flags delimited by &, see flags optional

Shows a table with all pages of the given namespace that were created in the specified month.

{{autoarchive>[namespace]}}

Creates an automatic archive.

Demo

You can try this plugin using the live demo.

Bugs / Feature Requests

Please report bugs or feature requests at the Bug tracker.

Further Resources

Changes

FAQ

Please also have a look at the blogging tips page!

My dates are shown wrong. What can I do?

Make sure you run the latest version of all required plugins and DokuWiki.

Is it possible to change the way the date is displayed?

Yes, the plugin uses the dformat option to format the date.

How can I alter the date of a blog post?

You can use the meta plugin to manually set the creation date (and modification date) in the page source, then select the modification date in the blog plugins order setting. An alternative solution would be to alter the timestamps of the created files, and remove the <dokuwiki>/data/index/cdate.idx (make backups if you intent to do that!!)

Discussion

The namespace parameter seems to be locked to the top of the site. I had thought that specifying a relative namespace (like ”.:news”) in the config would let people add their own news/status item lists to whatever parts of our site that they liked, but new entries were created all together in /news rather than under the namespace of the page where the “blog” tag appeared. Is this the intended behavior? It seems like the plugin would be perfect for news/status items, otherwise.

We have a wiki (http://php.twofourfour.org/dokuwiki/start) with 3 blogs in separate namespaces but one of them (http://php.twofourfour.org/dokuwiki/ltu/lulea) didn't want to show up until I forced the first post. The “New blog entry” box would show up in the preview but not in the saved page. Only after I created a first post via the preview did it work. Possible bug?

Refinement of listed blog posts with tags

I have been looking for some extension which could filter listed blog posts with some tags only. I haven't found any, so I started to look into blog/syntax/blog.php source code. Here I found that it's already done, but it's not documented anywhere. You can specify tags after the namespace in similar way like in {{topic>+tag1 -tag2}}. So, I suggest to change the explanation of [namespace] field in {{blog}} command above like this:

[namespace] namespace for the blog; subspaces will be searched as well; * is the whole wiki, . is the same namespace as the page lies in; after the space, you can specify a list of tags to refine, e.g. {{blog>ns +tag1 -tag2}} (syntax is similar to {{topic>+tag1 -tag2}}) optional; default is the blog namespace set in the configuration

Draft for an HowTo import blog posts (technical discussion)

Original question was: I 'imported' some blog posts from my old wiki into my new installation by copying the files while preserving the modification date (cp -p under Linux). I configured the blog plugin to sort posts by their creation date. But now on the blog overview page all the imported posts show up with a date when I copied the file in their footer instead of the date when the file was originally created (in my old wiki). Where does this date come from? – Robert

I think I already found out something: Could it be that the indexer does some work here? Could it be that the indexer has a bug, when he finds a completely new pages/somepost.txt? I think then it creates meta/somepost.meta with wrong dates or no dates at all. –Robert
This is not a bug of the indexer, but the desired functionality. Imagine someone edited a page outside of DokuWiki with a text editor, the indexer looks at the timestamps, if the timestamp is newer then the latest cached revisions it assumes (correctly) that the page has been modified. The only way to prevent this from happening is to make sure that the way you “import” the blog posts into the new Wiki preserves the file timestamps (Linux: cp -a). — Michael Klier 2008/10/10 17:22
Thank you for your quick reply. Wow I learned a lot about DokuWiki internals the last two nights :-) Ok, where I am heading to: I would be willing to write a detailed “HowTo import blog posts”. But as it seems an import is only possible if you sort your posts by date last changed. Even cp -p (in bash) does not preserve the date created, since there is no such thing as date created under Linux. PHP's function filectime only asks for the time the file's inode was last changed.

Lets dig into the details and have a look at the code. (Please correct me if anything is wrong here. All code is from the most current version of »> DokuWiki. Don't worry I'll soon refactor all this into an easy to read HowTo.)

You copy you blog post into you new DokuWiki: cp -p <oldwiki>/data/pages/mypost.txt <newwiki>/data/pages/

Once you actually view one of your blog posts in your browser, the indexer creates some additional files:
* data/meta/mypost.indexed and
* data/mega/mypost.meta
The meta index DOES NOT contain any date information. The lib/exe/indexer.php (lines 218) tries to extract some $info from the change.log. Which of course does not exist for the newly copied page, yet. As a consequence (line 226) no date can be written to the mypost.meta.

lib/exe/indexer.php:
>>>  // gather some additional info from changelog
>>>     $info = io_grep($conf['changelog'],
>>>                     '/^(\d+)\t(\d+\.\d+\.\d+\.\d+)\t'.preg_quote($ID,'/').'\t([^\t]+)\t([^\t\n]+)/',
>>>                     0,true);
>>> 
>>>     $meta = array();
>>>     if(!empty($info)){ ... }  # $info array will be empty for new files (=imported blog posts)
>>> 



When you look at your blog overview page the blog plugin
* first tries to get the date last modified from the meta information (plugin/blog/helper.php line 88)
* since that fails, it gets the date last modified via the PHP function filectime()

plugin/blog/helper.php:

>>> $date = $meta['date']['created'];
>>> if (!$date) $date = filectime(wikiFN($id));
>>> 



PHP manual about filectime:
Note also that in some Unix texts the ctime of a file is referred to as being the creation time of the file. This is wrong. There is no creation time for Unix files in most Unix filesystems.

To conclude: The blog plugin does the best it can to get the correct date created. But in the end this is not possible cause of limitations from the underlying filesystem.

⇒ Could I write a script that manually sets the metadata of my blog posts to a date I want. (When the metadata exists, it would be used by the blog plugin?

⇒ I am happy about any comments and/or corrections. As I said don't worry, I'll soon refactor all this. To all the DokuWiki developers: Keep up the good work! Robert

I've exactly got the same problem. Currently, I'm using the blog plugin version linked at the top of this page (the 2008-07-18 version). There is more this problem … but … I've got an other problem with it !! In the title, there a link on the post. It's very ugly! How can I remove the link ?? — Arnaud Fouquaut 2008/10/29 00:30

Help required

1

Hello I need to know where the blog plugin saves the data of the content. I have troubles restoring because in the file under the blog directory there is only the Entry

~~DISCUSSION~~

Hi, I would like to know if there's a way to limit the number of pages shown with the archive> ? Simão Belchior de Castro 2008/12/03 15:35

2

I just installed the blog plug in a few days ago, fist time. Does the 'New blog entry:' box require admin rights (ACL) or did I messed something up? See forum

3

Hello,

I just installed the blog pluguin an when I insert the {{blog>blog?5}} (for exemple), in the page appear:

Fatal error: Call to undefined method helper_plugin_include::get_flags() in /home/net/public_html/lib/plugins/blog/syntax/blog.php on line 181

Can you help me? Can you say me if you know this?.

Thank you!

Susana, 25/6/09 - 12:26

Make sure you have the latest version of the blog and include plugin.

Feature request

Not sure where I should ask for a feature to be added into the blog plugin, so here it is: I'd like to be able to schedule a blog entry to be published later. I don't always have time to update my blog on a daily basis, so it would be nice to be able to write a bunch of post in advance and schedule them to be published later so my reader can enjoy a new post every couple of days instead of a several posts in a row now and then. I try and failed to combine the timer plugin with this one.

Feature request: skip start pages and sidebar

To skip startpages and sidebar I (alsadi [At] ojuba . org) added the following two lines to helper.php

            $l=strlen($conf['start']);
            if (substr($id,-7,7) == 'sidebar' || substr($id,-$l,$l)==$conf['start']) continue;
 
plugin/blog.txt · Last modified: 2009/06/25 15:29 by 85.10.211.169
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsDarcsXRefTranslate