]> sipb.mit.edu Git - ikiwiki.git/blob - doc/forum/wiki_name_in_page_titles.mdwn
Added a comment
[ikiwiki.git] / doc / forum / wiki_name_in_page_titles.mdwn
1 I'd like to have the wiki name appear in page titles as in "WikiName:
2 Page Title."  If I use `<TMPL_VAR WIKINAME>: <TMPL_VAR TITLE>` in the
3 template this works for all pages except the index page itself which
4 will have title "WikiName: WikiName" as its title.  Does anyone know
5 of a template-based solution to this or do I need to write a plugin
6 that provides a `IS_HOMEPAGE` template variable? --[[JasonBlevins]]
7
8 > Hmm, one way to work around this is to put a meta title directive on the
9 > index page. Then TITLE will be that, rather than WIKINAME, and your
10 > template should work. --[[Joey]]
11
12 >> I ended up writing a [path][] plugin since I had some other
13 >> path-specific conditional things to include in my templates.
14 >>
15 >> So now I can do things like this:
16 >>
17 >>     <title>
18 >>     <TMPL_VAR WIKINAME><TMPL_UNLESS IS_HOMEPAGE>: <TMPL_VAR TITLE></TMPL_UNLESS>
19 >>     </title>
20 >>
21 >> But also more complicated path-specific conditionals like
22 >> `IN_DIR_SUBDIR` to indicate subpages of `/dir/subdir/`.  I've got a
23 >> few other small plugins brewing so I'll try to put up some contrib
24 >> pages for them soon. --[[JasonBlevins]]
25
26 [path]: http://jblevins.org/git/ikiwiki/plugins.git/plain/path.pm
27
28 > I used the following trick in some page.tmpl:
29 >
30 >     <title><TMPL_VAR WIKINAME><TMPL_IF NAME="PARENTLINKS">: <TMPL_VAR TITLE></TMPL_IF></title>
31 >
32 > --[[JeanPrivat]]