2 package IkiWiki::Plugin::google;
10 hook(type => "getsetup", id => "google", call => \&getsetup);
11 hook(type => "checkconfig", id => "google", call => \&checkconfig);
12 hook(type => "pagetemplate", id => "google", call => \&pagetemplate);
15 sub getsetup () { #{{{
23 sub checkconfig () { #{{{
24 foreach my $required (qw(url)) {
25 if (! length $config{$required}) {
26 error(sprintf(gettext("Must specify %s when using the google search plugin"), $required));
32 sub pagetemplate (@) { #{{{
34 my $page=$params{page};
35 my $template=$params{template};
37 # Add search box to page header.
38 if ($template->query(name => "searchform")) {
39 if (! defined $form) {
40 my $searchform = template("googleform.tmpl", blind_cache => 1);
41 $searchform->param(sitefqdn => URI->new($config{url})->host);
42 $form=$searchform->output;
45 $template->param(searchform => $form);