Blog Plugin

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

Last updated on 2009-09-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, 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!:! The Bundle Hub might not always be in sync with the downloads provided by github :!:
    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
    showhistorgram Display a histogram in normal archive mode (not for autoarchive)

    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

    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

    Problem - solved

    I got a lot of the following error messages instead of the blogs contents even when using (Nov.2009) actual versions of dokuwiki, blog and related plugins:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in .../dokuwiki-2009-02-14/lib/plugins/blog/syntax/blog.php on line 184

    Could be fixed with the following modification to blog/syntax/blog.php (diff output):

    184c184
    <                 call_user_func_array($i[1], array(&$renderer, $i[0]));
    ---
    >                 call_user_func_array(array(&$renderer, $i[0]), $i[1]);
     
    plugin/blog.txt · Last modified: 2009/12/02 10:04 by 86.59.100.100
     
    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
    WikiForumIRCBugsGitXRefTranslate