5dbbe4f8271b2d6519363618e1f2b50e8923af33
[ikiwiki.git] / doc / todo / transient_in-memory_pages.mdwn
1 On [[todo/auto-create_tag_pages_according_to_a_template]], [[chrysn]]
2 suggests:
3
4 > Instead of creating a file that gets checked in into the RCS, the
5 > source files could be left out and the output files be written as
6 > long as there is no physical source file (think of a virtual underlay).
7 > Something similar would be required to implement alias directive,
8 > which couldn't be easily done by writing to the RCS as the page's
9 > contents can change depending on which other pages claim it as an alias.
10
11 `add_autofile` could be adapted to do this, or a similar API could be
12 added.
13
14 This would also be useful for autoindex, as suggested on
15 [[plugins/autoindex/discussion]]. I'd also like to use it for
16 [[plugins/contrib/album]].
17
18 One refinement I'd suggest is that if the transient page is edited,
19 its transient contents are evaluated and used as the initial
20 content for the edit box; after that, it'd become a static page. --[[smcv]]
21
22 --------------------------
23
24 [[!template id=gitbranch branch=smcv/transient author="[[smcv]]"]]
25 [[!tag patch]]
26
27 I had a look at implementing this. It turns out to be harder than I thought
28 to have purely in-memory pages (several plugins want to be able to access the
29 source file as a file), but I did get this proof-of-concept branch
30 to write tag and autoindex pages into an underlay.
31
32 This loses the ability to delete the auto-created pages (although they don't
33 clutter up git this way, at least), and a lot of the code in autoindex is
34 probably now redundant, so this is probably not quite ready for merge, but
35 I'd welcome opinions.
36
37 Usage: set `tag_underlay` and/or `autoindex_underlay` to an absolute path,
38 which you must create beforehand. I suggest *srcdir* + `/.ikiwiki/transient`.
39
40 Refinements that could be made if this approach seems reasonable:
41
42 * make these options boolean, and have the path always be `.ikiwiki/transient`
43 * improve the `remove` plugin so it also deletes from this special underlay