Modifying IkiWiki

(Blog software announcement 2019-2)

It's incredible how flexible IkiWiki is.

For changing the page output, you can create a templates directory and copy your ikiwiki installation's page.tmpl to there - that's it! This will override the template and you can start making changes to it. (That's how I got the additional CTIME/MTIME lines added, where most of the time only one of them was provided so it felt for me as if information was missing when looking only at a single page...)

For changing code (at least as long as it's part of a plugin), you can set a libdir in the config, set up the required subdirectories IkiWiki/Plugin, copy your ikiwiki installation's comments.pm to there - and it'll override the installed plugin, so you can start to make live code changes.

Local avatars in comments

--- IkiWiki/Plugin/comments-20190509-1-ikiwiki_3_20141016_4_deb8u1.pm.bak  2017-01-11 19:18:52.000000000 +0100
+++ IkiWiki/Plugin/comments.pm 2019-05-10 04:25:09.364000000 +0200
@@ -641,8 +641,20 @@
    my $user=shift;
    return undef unless defined $user;
 
    my $avatar;
+
+  # Try using a locally hosted avatar, first.
+  if ($user !~ m#^(?:\.|\.\.|.*/.*)$#) {
+      foreach my $testuri (
+          '/avatar/'.$user.'.png',
+          '/avatar/'.$user.'.jpg'
+      ) {
+              return $testuri if -f $config{destdir}.$testuri;
+      }
+  }
+
+  # Only then embed external resources.
    eval q{use Libravatar::URL};
    if (! $@) {
        my $oiduser = eval { IkiWiki::openiduser($user) };
        my $https=defined $config{url} && $config{url}=~/^https:/;

View raw file


For reference, find a list of related articles embedded here:

Blog software announcements 2019-n

  1. Blog via IkiWiki - Setup of blog (software)
  2. Modifying IkiWiki - Local modifications to blog software
  3. ikiwiki upgraded to version in upcoming Debian 10