Welcome to 2019
[ikiwiki.git] / IkiWiki / Plugin / favicon.pm
1 #!/usr/bin/perl
2 # favicon plugin.
3
4 package IkiWiki::Plugin::favicon;
5
6 use warnings;
7 use strict;
8 use IkiWiki 3.00;
9
10 sub import {
11         hook(type => "getsetup", id => "favicon", call => \&getsetup);
12         hook(type => "pagetemplate", id => "favicon", call => \&pagetemplate);
13 }
14
15 sub getsetup () {
16         return
17                 plugin => {
18                         safe => 1,
19                         rebuild => 1,
20                 },
21 }
22
23 sub pagetemplate (@) {
24         my %params=@_;
25
26         my $template=$params{template};
27         
28         if ($template->query(name => "favicon")) {
29                 $template->param(favicon => "favicon.ico");
30         }
31 }
32
33 1