#!/usr/bin/perl package IkiWiki::Plugin::google; use warnings; use strict; use IkiWiki 3.00; use URI; sub import { hook(type => "getsetup", id => "google", call => \&getsetup); hook(type => "checkconfig", id => "google", call => \&checkconfig); hook(type => "pagetemplate", id => "google", call => \&pagetemplate); } sub getsetup () { return plugin => { safe => 1, rebuild => 1, section => "web", }, } sub checkconfig () { if (! length $config{url}) { error(sprintf(gettext("Must specify %s when using the %s plugin"), "url", 'google')); } # This is a mass dependency, so if the search form template # changes, every page is rebuilt. add_depends("", "templates/googleform.tmpl"); } my $form; sub pagetemplate (@) { my %params=@_; my $page=$params{page}; my $template=$params{template}; # Add search box to page header. if ($template->query(name => "searchform")) { if (! defined $form) { my $searchform = template("googleform.tmpl", blind_cache => 1); $searchform->param(url => $config{url}); $searchform->param(html5 => $config{html5}); $form=$searchform->output; } $template->param(searchform => $form); } } 1 class='sub right'>Jonas Smedegaard
summaryrefslogtreecommitdiff
path: root/tags/02/29/20170619220345.9202F6CC5@lxp5.free-owl.de/sys
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2023-06-27 09:35:08 +0200
committerJonas Smedegaard <dr@jones.dk>2023-06-27 09:35:08 +0200
commitfd54908da2b05c526dd3bee9b6dcd093214a220d (patch)
treec69c845069c99d1d01044f6fafda7c08433329c6 /tags/02/29/20170619220345.9202F6CC5@lxp5.free-owl.de/sys
parentba46132213560cf3335d53560d519c0ec0190da2 (diff)
master
Diffstat (limited to 'tags/02/29/20170619220345.9202F6CC5@lxp5.free-owl.de/sys')