19

I have a DokuWiki and I'd like to place a logo on the title bar at the top of the page? How can I do this? Note that I am not referring to the title bar at the top of the browser, but rather the title bar on the website itself.

I tried inserting the DokuWiki syntax: {{public:logo.jpg?100x100}}, but this simply rendered as plain text and not an image.

Is it possible to put an image in the page title?

Shoban
  • 22,920
  • 8
  • 63
  • 107
samoz
  • 56,849
  • 55
  • 141
  • 195

4 Answers4

38

Easy: Rename your logo as "logo.png" and place it into :wiki namespace. It will show automatically.

This solution works on template "dokuwiki" (default one on dokuwiki old stable version "Adora Belle" and in current one "Weatherwax"):

Deeper:

We can look at tpl_header.php file, lines 21&23:

// get logo either out of the template images folder or data/media folder

[...]

$logo = tpl_getMediaFile(array(':wiki:logo.png', 'images/logo.png'), false, $logoSize);

Ok: tpl_getMediaFile() function will look for a file logo.png in media namespace called wiki.

So I go to dokuwiki File Manager and I upload my logo.png file on wiki namespace. I refresh page and I smile.

solution with dokuwiki File Manager

Hope That Helps

Katapofatico
  • 750
  • 1
  • 10
  • 29
3

In modern versions of DokuWiki you don't have to make your own template. Simply upload a file called logo.png to the wiki or root namespace in the DokuWiki Media Manager.

This is the line of template code that gets the logo: https://github.com/splitbrain/dokuwiki/blob/master/lib/tpl/dokuwiki/tpl_header.php#L23

You can tell that it is first checking logo.png in the wiki namespace with :wiki:logo.png and then logo.png in the root namespace with :logo.png.

If it doesn't find either, it falls back on images/logo.png, which is the default logo.

MikroDel
  • 6,705
  • 7
  • 39
  • 74
rryan
  • 797
  • 1
  • 7
  • 6
  • Just to note that this is apparently a functionality of the default template, not the DokuWiki itself. Hence it will most probably not work with other templates. – famousgarkin Jan 15 '14 at 13:46
1

(for latest versions of Dokuwiki)

You should create your own template, and do whatever hack you need to do.

It is located in lib/tpl/

Just copy the default directory with your own name (this will be available in the admin area later), something like "company", and edit:

  <div class="pagename">
    <img src="<?php echo DOKU_TPL; ?>images/logo.png" align="absmiddle"/>
    [[<?php tpl_link(wl($ID,'do=backlink'),tpl_pagetitle($ID,true),'title="'.$lang['btn_backlink'].'"')?>]]
  </div>

You can build the HTML as you like... but the example above works just fine (the image is located in the lib/tpl/company/images/)

You can then change the template of your Wiki by updating the configuration at: Admin > configuration manager > template

bruno.braga
  • 1,001
  • 12
  • 21
-2

There's no config option for this, you'd have to hack it in \dokuwiki-2009-02-14\lib\tpl\index.php I'm afraid.

Ross
  • 46,186
  • 39
  • 120
  • 173
  • Well, a better solution would be to build a plugin or a template but I'm not sure how those work with dokuwiki (something on my todo list). I've got a feeling plugins only affect page content but templates might help you. – Ross Mar 10 '09 at 18:22
  • `./lib/tpl/index.php` is **completely wrong**! You won't be able to change the logo or anything else in that file as it is not used for the template or anything you can see on your wiki. (It's only there to show your active template's colour settings.) – selfthinker Nov 18 '12 at 13:11
  • Maybe there was no config option back in 2009, but in later versions of Dokuwiki there is a possibility to config the logo easily, as this other answer in this threat explains: https://stackoverflow.com/a/12901769/3495761 – skotperez Sep 30 '20 at 12:46