]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/more_customisable_titlepage_function.mdwn
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[ikiwiki.git] / doc / todo / more_customisable_titlepage_function.mdwn
1 I understand the `IkiWiki::titlepage` function is used to generate filenames from titles. It would be nice if there were an easier way to override what it does. I suppose I could write an *external* plugin and call `inject`, but maybe this could instead be done via the configuration file?
2
3 I imagine two things: a lookup hash and a template.
4
5 Since `IkiWiki::titlepage` basically translates characters, it would be cool to be able to define a lookup hash in the configuration, which would be consulted before falling back to the generic `__xx__` `ord()` representation of a letter. For instance, in German, I might prefer to have 'Ã\83¤' become 'ae' instead of something illegible.
6
7 Second, maybe a template could be honoured. The template could have a slot `%s` where the calculated title goes, and it could contain `strftime` symbols as well as variables, which get interpolated on use.
8
9 Another option would be a function I could define in the setup file, or an external script, though that would be pretty expensive.
10
11 -- [[madduck]]
12
13 I don't think that changing titlepage is a good idea, there are
14 compatability problems.
15
16 Instead, I think that in the specific case of the blogpost form, there
17 should be an interface to allow plugins to do arbitrary transformatiosn of
18 the page name.
19
20 So, add a hidden field to blogpost.tmpl, something like blogpost=1. Then in
21 `editpage`, if blogpost is set, call the blogpost hooks, which are passed
22 a page name and return a transformed version.
23
24 If the page name is changed by those, then the user's original title might
25 need to be preserved via a meta title directive. This could just be
26 inserted if any changes are made to the page name. Only problem with this
27 is that having the directive appear in the edit box for a new page could
28 confuse the user. The title could be passed on in a hidden field, and
29 prepended to the page when it's saved..
30
31 [[wishlist]]