2 package IkiWiki::Plugin::google;
12 hook(type => "getsetup", id => "google", call => \&getsetup);
13 hook(type => "checkconfig", id => "google", call => \&checkconfig);
14 hook(type => "pagetemplate", id => "google", call => \&pagetemplate);
26 if (! length $config{url}) {
27 error(sprintf(gettext("Must specify %s when using the %s plugin"), "url", 'google'));
29 my $uri=URI->new($config{url});
30 if (! $uri || ! defined $uri->host) {
31 error(gettext("Failed to parse url, cannot determine domain name"));
37 sub pagetemplate (@) {
39 my $page=$params{page};
40 my $template=$params{template};
42 # Add search box to page header.
43 if ($template->query(name => "searchform")) {
44 if (! defined $form) {
45 my $searchform = template("googleform.tmpl", blind_cache => 1);
46 $searchform->param(sitefqdn => $host);
47 $form=$searchform->output;
50 $template->param(searchform => $form);