DokuWiki

It's better when it's simple

Strumenti Utente

Strumenti Sito


Barra laterale

Questa traduzione è più vecchia di quella della pagina originale è potrebbe essere superata. Vedi cosa è cambiato.
Traduzioni di questa pagina?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

it:tips:blogging

Blogging with DokuWiki - Un volontario (che sa fare - anche poco) inizi!

:!: This page is a WORK IN PROGRESS! If you feel you can add to it please improve it wherever you see fit! :!:

Although blogging isn't the main purpose of DokuWiki, there are quite a large number of plugins available, which can turn DokuWiki into a full fledged blogging platform.

Questa pagina descrive i passi necessari per partire con un blog basato su Dokuwiki. Esso fornisce anche degli utili suggerimenti e scorciatoie riguardo possibili precisazioni.

If you want to discover existing DokuWiki-based blogs, visit Planet DokuWiki, or try this Google search: inurl:doku.php+inurl:blog.

Required Plugins

First of all you have to install a set of plugins. The basic blog setup consists of the blog, include and the pagelist plugins, which represent the minimal install of the blog suite.

In addition to these, you may complete your blog setup using the discussion, linkback, bloglinks, feedmod, avatar, and tag plugins.

Most of these plugins depend on each other. To help ease the setup process there's the Blogsuite Bundle Hub (NOTE the bundlehub plugins might not always be up to date - check the versions :!:). There you can decide about your desired blog setup and download one single archive which can be installed and updated via the pluginmanager.

Setup

Single-User

In this scenario we have only one single user who wants to use the blog plugin to create manage one blog. The configuration of the blog plugin lets you specify a namespace where all the blog entries will be stored. By default this is set to :blog which should be OK for most users.

To create the blog you have to decide which wiki page you'd like to use for the blog first and create it. If you want the blog to be the start page of the wiki this would be :start. After that you just have to add the blog plugin syntax to the page and save it.

{{blog>?5}}

The above will display the five latest entries in our blog. Since this is a single-user setup there's no need to specify a namespace in the plugin syntax, instead the default setting will be used. You should see a form now to add new blog entries. But before you add your first entry there's one configuration option left which needs to be set, namely the dateprefix setting. It can be used to add the date the page was created to the page name of the new page. A good setting here is %Y:%m%d_. What happens here is that when you enter “my new blog” into the new entry form and press enter, the following page will created blog:2008:0512_my_new_blog. You see this comes in quite handy to keep your blog namespace organized.

In order to only allow read access to your blog to prevent people from editing your entries it also makes sense to add some ACL rules (the example assumes that you use the :start page for the blog listing).

start    @ALL 1
start    yourusername 16
blog:*   @ALL 1
blog:*   yourusername 16

Multi-User

In this scenario we want to allow different users to have their own blog. For that, each user needs his own blogging namespace and blog listing page where only he is allowed to create and edit pages. For this example we have three users named joey, walter and susi. Each user gets his own namespace below the :blog namespace and his own listing page. Therefore we have to setup the following ACL rules (example for the user joey):

blog:joey    @ALL 1
blog:joey:*  @ALL 1
blog:joey    joey 16
blog:joey:*  joey 16

Now you have to create the page :blog:joey and insert the following blog plugin syntax to setup the blog.

{{blog>blog:joey?5}}

Repeat that for all remaining users. After that they can start blogging by creating new entries with the new entry form.

Feed Setup

One of the most important things in a blog is its RSS feed. DokuWiki automatically creates all kind of feeds for you. But for a blog you may want to setup a specially tuned one.

Note: Since the new DokuWiki supports full HTML feeds it's no longer recommended to use the feed plugin to create the blog feed (it's still useful for discussion feeds and the like though).

Determine your feed URL

You will need some parameters to build your blog article feed. Most important is the ns parameter to limit the feed to your blog articles only. Remember not to use the blog frontpage for the feed because it will result in all your blog entries being included in one single feed item!

Here is a most basic example URL:

http://www.example.com/feed.php?ns=blog&num=10

You should also make sure it links to the most current version of your article. You can either set the default options to do so or pass it along to feed.php:

http://www.example.com/feed.php?ns=blog&num=10&linkto=current

You will most probably also enable DokuWiki's full html feed:

http://www.example.com/feed.php?ns=blog&num=10&linkto=current&content=html

Nice feed URLs with .htaccess

If you have URL rewriting via .htaccess enabled you should also consider to add some custom rewrite rules to have nice feed URLs. The rewrite rule for the above example would look like this (just add it below the rule for the _export/ links):

RewriteRule ^_feed/(.*) feed.php?ns=$1&num=10&linkto=current&content=html [QSA,L]

Now you can access you blog feed with http://yourdomain.org/_feed/blog.

Autodiscovery

Browsers can discover RSS feeds by certain HTML metadata. By default DokuWiki will provide this metadata for its standard feeds on its own. For a blogging page you might want to disable those feeds and only output your blog feed. This is done by editing your template's main.php. Here is an example head section:

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title><?php tpl_pagetitle()?> [<?php echo strip_tags($conf['title'])?>]</title>
 
  <?php tpl_metaheaders(false)?>
  <link rel="alternate" type="application/rss+xml" title="Blog" href="/feed.php?ns=blog&amp;linkto=page" />
</head>

Notice the parameter false being passed to the tpl_metaheaders function. This will suppress all default RSS autodiscovery tags.

Usage

Using Drafts

There are two different ways of dealing with unfinished blog entries in DokuWiki. You could for example setup a dedicated draft namespace where you store them, and at the time you finish them just create the blog entry and copy/paste the article. However, the blog plugin also supports drafts. To mark a blog entry as draft simply put ~~DRAFT~~ into the entry and save it. It will not show up in the blog listing unless you remove ~~DRAFT~~ from the page again. If you want to use this feature it's recommend to also install the feedmod plugin as it also removes drafts from the blog feed. Note: Pages marked as draft with blog plugin still show up in search results!

Managing Comments

The discussion plugin provides an administration interface available in DokuWiki's admin menu which allows you to close/open discussions and show/hide/delete comments.

Managing Linkbacks

The linkback plugin also provides an administration interface which allows you to delete linkbacks or enable/disable them for single pages.

Managing Tags

The latest tag plugin provides an administration interface which lets you rebuild the tag index. The tagentry plugin also provides a grate functionality to keep control over your tags.

Customization

FIXME

Displaying only the first section on the front page

Sometimes you don't want to show a full article on the front page because it is too long. To cut it off at a given line, just insert an empty H1 header. To make that work you also have to activate the firstseconly configuration option of the include plugin.

This is going to be a long post

====== ======

Here comes all the long post

Tuning the feed

DokuWiki's default feed is not 100% suitable for blogging, like it will display the page name as title of the feed item instead of the first headline. To change that you can use the feedmod plugin. It will set the first headline of the blog entry as feed item title and also adds a footer which links to the discussion section, and displays the tags of the post. Furthermore you can add links to social bookmarking services by editing a footer template (for more information please refer to the feedmod plugin page).

Another simple way to add additional features to your feed is to use the Feedburner service. Register at their site, point them to your feed (See Determine your feed URL) and put the Feedburner feed into the autodiscovery tag. This will also move some server load from your site to the Feedburner services.

Dealing with SPAM

Comment SPAM is quite a problem these days. Luckily DokuWiki provides a number of anti spam plugins. Support for the captcha plugin is integrated into the discussion plugin. All you have to do is install it and set it up to your likings.

Caveats

Treat your filesystem carefully

FIXME

Tips

Fixing wrong timestamps

FIXME

Some timestamp issues I came across:

  • As mentioned in the discussion of the meta plugin, feed.php ignores settings of ~~META: …~~. (Usually getRecents() from changelog.php is called, which doesn't seem to support it?) This results in a mismatch between blog listing like {{blog>blog?5}} and feed.php?ns=blog&num=5, which is unexpected.
  • Also, it is currently not possible to let feed.php list only newly created pages (and sort them by descending creation date). (Because getRecents() does provide listing only newly created pages.) I note that this listing is possible with the changes plugin, but this code isn't used in feed.php.
  • An alternative approach using alphabetic ordering of pages by name could also solve issues if the items have pagenames like :blog:YYYY-MM:DD-pagetitle or similar. Then the feed.php is consistent with the permalinks of the blog, which would be nice.

Louwrens van Dellen 2010/05/03 23:23

Discussion

Change order of "linkback" and "discussion" in rendered wiki page

Is it possible (without changing source/templates) to change the order of the discussion and the linkback plugin? If there is no way without editing, could anybody who is more often editing the code than me, give a hint into the right direction? (I am “speaking” HTML/CSS/PHP)

Thanks, Ralf

it/tips/blogging.txt · Ultima modifica: 2014-01-03 22:25 da 93.147.173.191