summaryrefslogtreecommitdiff
path: root/doc/forum/wiki_name_in_page_titles.mdwn
blob: 4e9e51835e3047aa0aff62ed0e1b40be796bf964 (plain)

I'd like to have the wiki name appear in page titles as in "WikiName: Page Title." If I use <TMPL_VAR WIKINAME>: <TMPL_VAR TITLE> in the template this works for all pages except the index page itself which will have title "WikiName: WikiName" as its title. Does anyone know of a template-based solution to this or do I need to write a plugin that provides a IS_HOMEPAGE template variable? --[[JasonBlevins]]

Hmm, one way to work around this is to put a meta title directive on the index page. Then TITLE will be that, rather than WIKINAME, and your template should work. --[[Joey]]

I ended up writing a path plugin since I had some other path-specific conditional things to include in my templates.

So now I can do things like this:

<title>
<TMPL_VAR WIKINAME><TMPL_UNLESS IS_HOMEPAGE>: <TMPL_VAR TITLE></TMPL_UNLESS>
</title>

But also more complicated path-specific conditionals like IN_DIR_SUBDIR to indicate subpages of /dir/subdir/. I've got a few other small plugins brewing so I'll try to put up some contrib pages for them soon. --[[JasonBlevins]]

I used the following trick in some page.tmpl:

<title><TMPL_VAR WIKINAME><TMPL_IF NAME="PARENTLINKS">: <TMPL_VAR TITLE></TMPL_IF></title>

--[[JeanPrivat]]