]> sipb.mit.edu Git - ikiwiki.git/blob - doc/forum/transition_from_handwritten_html_to_ikiwiki.mdwn
Added a comment
[ikiwiki.git] / doc / forum / transition_from_handwritten_html_to_ikiwiki.mdwn
1 I'm trying to convert hand written html site to ikiwiki and maintain url compatibility. html plugin with indexpages=1 converts all dir_name/index.html correctly to dir_name urls with wiki/css based content, but somedir/somefile.html files are only accessible as somedir/somefile/. Non .html files seem to accessible with their full paths, for example somedir/pic.jpg from hand written html can be accessed by same path under ikiwiki.
2
3 How to make somedir/somefile.html accessible as somedir/somefile.html under ikiwiki?
4
5 Thanks,
6
7 -Mikko
8
9 > Hello! The options you need to investigate are `--usedirs` and
10 > `--no-usedirs`. The default `--usedirs` takes any source page foo
11 > (regardless of its format, be it markdown or html) and converts it into a
12 > destination page foo/index.html (URL foo/). By comparison, `--no-usedirs`
13 > maps the source file onto a destination file directly: src/foo.html becomes
14 > dest/foo.html, src/bar.mdwn becomes dest/bar.html, etc.
15
16 > It sounds like you want `--no-usedirs`, or the corresponding `usedirs => 0,`
17 > option in your setup file. See [[usage]] for more information. -- [[Jon]]
18
19 Thanks, usedirs seems to be just the thing I need.
20
21 -Mikko
22
23 Actually usedirs didn't do exactly what I want. The old site contains both
24 somedir/index.html and somedir/somename.html files. With html plugin and 
25 indexpages=1 the somedir/index.html pages are accessed correctly but 
26 somedir/somefile.html files not.
27
28 With usedirs => 0, somedir/somename.html pages are accessed correctly but
29 somedir/index.html pages are not. Actually the handwritten somedir/index.html
30 files were removed on a rebuild:
31
32     $ ikiwiki -setup blog.setup -rebuild -v
33     ...
34     removing test2/index.html, no longer built by test2
35
36 Is there a way for both index.html and somename.html raw html files to show up through ikiwki?
37
38 -Mikko
39
40 > I think you want usedirs => 0 and indexpages => 0?
41 >
42 > What IkiWiki does is to map the source filename to an abstract page name
43 > (indexpages alters how this is done), then map the abstract page name
44 > to an output filename (usedirs alters how this is done).
45 >
46 > The three columns here are input, abstract page name, output:
47 >
48 >     usedirs => 0, indexpages => 0:
49 >         a/index.html -> a/index -> a/index.html
50 >         a/b.html -> a/b -> a/b.html
51 >     usedirs => 1, indexpages => 0:
52 >         a/index.html -> a/index -> a/index/index.html
53 >         a/b.html -> a/b -> a/b/index.html
54 >     usedirs => 0, indexpages => 1:
55 >         a/index.html -> a -> a.html
56 >         a/b.html -> a/b -> a/b.html
57 >     usedirs => 1, indexpages => 1:
58 >         a/index.html -> a -> a/index.html
59 >         a/b.html -> a/b -> a/b/index.html
60 >
61 > The abstract page name is what you use in wikilinks and pagespecs.
62 >
63 > What I would suggest you do instead, though, is break your URLs once
64 > (but put in Apache redirections), to get everything to be consistent;
65 > I strongly recommend usedirs => 1 and indexpages => 0, then always
66 > advertising URLs that look like <http://www.example.com/a/b/>. This is
67 > what ikiwiki.info itself does, for instance. --[[smcv]]
68
69 Thanks for the explanation. usedirs => 0 and indexpages => 0 does the trick,
70 but I'll try to setup mod_rewrite from foo/bar.html to foo/bar in the final 
71 conversion.
72
73 -Mikko
74
75 > That's roughly what I do, but you can do it with `Redirect` and `RedirectMatch` from `mod_alias`, rather than fire up rewrite. Mind you I don't write a generic rule, I have a finite set of pages to redirect which I know. -- [[Jon]]
76
77 I'm getting closer. Now with usedirs => 1 and raw html pages, ikiwiki transforms foo/index.html to foo/index/index.html.
78 Can ikiwiki be instructed map foo/index.html to page foo instead that foo/index?
79
80 -Mikko
81
82 > If you don't already have a foo.html in your source, why not just rename foo/index.html to foo.html? With usedirs, it will then map to foo/index.html. Before, you had 'foo/' and 'foo/index.html' as working URLS, and they will work after too. 
83
84 > If you did have a foo.html and a foo/index.html, hmm, that's a tricky one. -- [[Jon]]
85
86 > We may be going round in circles - that's what indexpages => 1 does :-)
87 > See the table I constructed above, which explains the mapping from input
88 > files to abstract page names, and then the mapping from abstract page
89 > names to output files. (I personally think that moving your source pages
90 > around like Jon suggested is a better solution, though. --[[smcv]]