From c8214300ed6198d3a59cc1e3b3d74b0722c26b91 Mon Sep 17 00:00:00 2001 From: "http://jmtd.livejournal.com/" Date: Thu, 7 Oct 2010 12:37:02 +0000 Subject: [PATCH] other purpose --- .../use_templates_for_the_img_plugin.mdwn | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/todo/use_templates_for_the_img_plugin.mdwn b/doc/todo/use_templates_for_the_img_plugin.mdwn index d6dce8c63..1cee1b535 100644 --- a/doc/todo/use_templates_for_the_img_plugin.mdwn +++ b/doc/todo/use_templates_for_the_img_plugin.mdwn @@ -7,3 +7,23 @@ The patches in convert th I originally thought of this to solve the problem outlined in [[bugs/can't mix template vars inside directives]], before I realised I could wrap the `img` call in my pages with a template to achieve the same thing. I therefore sat on it. However, I since thought of another use for this, and so started implementing it. (note to self: explain this other use) + +---- + +Ok, I have managed to achieve what I wanted with stock ikiwiki, this branch might not have any more life left in it (but it has proven an interesting experiment to see how much logic could be moved from `img.pm` into a template relatively easily. Although the template is not terribly legible.) + +My ikiwiki page has a picture on the front page. I've changed that picture just once, but I would like to change it again from time to time. I also want to keep a "gallery", or at least a list, of previous pictures, and perhaps include text alongside each picture, but not on the front page. + +I've achieved this as follows + + * each index picture gets a page under "indexpics". + * the "indexpics" page has a raw inline to include them all[1] + * the front page has more-or-less the same inline, with show=1 + * each index picture page has a [[plugins/conditional]]: + * if you are being included, show the resized picture only, and link the picture to the relevant indexpic page + * else, show the picture with the default link to a full-size image, and include explanatory text. + * most of the boilerplate is hidden inside a template + +It is not quite as I envisaged it: the explanatory text would probably make sense on the indexpics "gallery" page, but since that includes the page, the wrong trouser-leg of the conditional is used. But it works quite well. Introducing a new index picture involves creating an appropriate page under indexpics and the rest happens automatically. + +[1] lie #1: the pagespec is a lot more complex as it has to exclude raw image filetypes