(no commit message)
[ikiwiki.git] / doc / todo / Post-compilation_inclusion_of_the_sidebar.mdwn
1 In some sites (mine, for example), the pages are quasi-static, while the sidebar must be updated at each commit
2 (because it contains some lists, like "last posts" or "last updates", or a tagcloud). As this sidebar is included
3 in every page of the site, many commits can potentialy leat to a full re-compilation....
4
5 I think a sidebar included after the compilation (via a SSI mechanism for example) would make sense and 
6 reduce the dependencies.
7
8 Different things could be possible:
9
10 * output as .shtml instead of .html
11 * ignore the sidebar->page dependency links
12 * consider the *real* dependencies; pageA may include the title (only) of pageB, but don't need to be recompiled 
13 after each typo correction on pageB.
14
15 shtml output with open cgi web access is a potential security hole and can DoS the site, but it's not a problem for a 
16 single-editor site.
17
18 NicolasLimare
19
20 > This is a good idea, though sadly not portable enough to be the default.
21 > Especially if the only way to do it is with .shtml.
22 > But I really like the idea of not rebuilding the sidebar all the time. 
23 > Definitly a TODO, for me, if I can figure out how to do it. Patches
24 > eagerly accepted. 
25
26 > I have implemented a htmlext configuration item, that lets you control
27 > what extension ikiwiki uses for output html pages. So in theory, a
28 > sidebar could be done as you describe using .shtml. --[[Joey]]
29
30 [[wishlist]]
31
32 > I have a plan for a way to avoid unecessary rebuilds caused by the
33 > sidebar. The idea is to use wikistate to store what a sidebar renders to.
34 > Then in the needsbuild hook, render sidebar(s) and compare with their
35 > previous stored rendering. If a sidebar's rendered content has changed,
36 > then all pages that display that sidebar need to be forced to be rebuilt.
37
38 > Also, if there is no previous stored rendering for a sidebar, or
39 > if there is a stored rendering for a sidebar page that no longer exists, then
40 > the pages need to be rebuilt. (This should deal with the [[bugs/Building_a_sidebar_does_not_regenerate_the_subpages]] bug.
41
42 > This would also save significant time, since the stored sidebar rendering
43 > could just be dumped into the page by the pagetemplate hook. Current code
44 > re-loads and renders the same sidebar file for every page built!
45
46 > The sticky part is (relative) links on the sidebar. These would need to
47 > be modified somehow depending on the page that the sidebar is placed on,
48 > to not break the link.
49
50 > Another wrinkle is changing subpage links on a sidebar. Suppose a sidebar
51 > links to page `foo`. If page `bar/foo` exists, the sidebar on page bar will, 
52 > currently, link to that page, in preference to a toplevel `foo`.
53 > If `bar/foo` is removed, it will update to link to `foo`. With the new
54 > scheme, the stored sidebar rendering is not for page `foo`, and so
55 > the change of the `bar/foo` link will not be noticed or acted on.
56 > Granted, it's unlikely that anyone relies on the current behavior. You
57 > generally want links on a sidebar to link to the same place on every page
58 > that displays it. So finding some way to force all links on a sidebar to 
59 > be handled absolutely and documenting that would avoid this problem.
60 >
61 > So, one way to handle both the above problems would be to use the
62 > pre-rendered sidebar for each page, but use a html parser to look for
63 > links in it, and munge them to work as relative links on the page the
64 > sidebar is being added to. Or, if the wiki's url is known, just do this
65 > once when rendering the sidebar, adding the full url to the links.
66 > (Maybe require `url` be set when using sidebar?)
67 > --[[Joey]]