aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-10-29 18:05:58 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-10-29 18:05:58 -0400
commitc29957e0177c3c654a1ea1feffdba00307449560 (patch)
tree26a72556f580619bba07d9af99d92db05ee7626a
parent29f2cf4a49fb4d11ef92d0c9d1a8343181f6af6c (diff)
downloadikiwiki-c29957e0177c3c654a1ea1feffdba00307449560.tar
ikiwiki-c29957e0177c3c654a1ea1feffdba00307449560.tar.gz
google: Pass the whole wiki url to google, not just the domain, so that search works correctly for wikis that are located in subdirectories of domains.
-rw-r--r--IkiWiki/Plugin/google.pm9
-rw-r--r--debian/changelog3
-rw-r--r--doc/plugins/google/discussion.mdwn2
-rw-r--r--templates/googleform.tmpl2
4 files changed, 7 insertions, 9 deletions
diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm
index 1683220e7..483fa1707 100644
--- a/IkiWiki/Plugin/google.pm
+++ b/IkiWiki/Plugin/google.pm
@@ -6,8 +6,6 @@ use strict;
use IkiWiki 3.00;
use URI;
-my $host;
-
sub import {
hook(type => "getsetup", id => "google", call => \&getsetup);
hook(type => "checkconfig", id => "google", call => \&checkconfig);
@@ -26,11 +24,6 @@ sub checkconfig () {
if (! length $config{url}) {
error(sprintf(gettext("Must specify %s when using the %s plugin"), "url", 'google'));
}
- my $uri=URI->new($config{url});
- if (! $uri || ! defined $uri->host) {
- error(gettext("Failed to parse url, cannot determine domain name"));
- }
- $host=$uri->host;
}
my $form;
@@ -43,7 +36,7 @@ sub pagetemplate (@) {
if ($template->query(name => "searchform")) {
if (! defined $form) {
my $searchform = template("googleform.tmpl", blind_cache => 1);
- $searchform->param(sitefqdn => $host);
+ $searchform->param(url => $config{url});
$form=$searchform->output;
}
diff --git a/debian/changelog b/debian/changelog
index 4c8c4d6fc..f19b4eae4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,9 @@ ikiwiki (3.20091024) UNRELEASED; urgency=low
url is uri-encoded. Most browsers other than MSIE don't care, but it's
the right thing to do.
* Add a spec file to allow building rpm from the source package.
+ * google: Pass the whole wiki url to google, not just the domain,
+ so that search works correctly for wikis that are located in
+ subdirectories of domains.
-- Joey Hess <joeyh@debian.org> Mon, 26 Oct 2009 11:53:32 -0400
diff --git a/doc/plugins/google/discussion.mdwn b/doc/plugins/google/discussion.mdwn
index 39403f9f9..94fc36a35 100644
--- a/doc/plugins/google/discussion.mdwn
+++ b/doc/plugins/google/discussion.mdwn
@@ -9,3 +9,5 @@ It works to pass the whole wiki baseurl to Google, not just the
domain, and appears to be legal. I've got a wiki that'd benefit
(it's a few directories down from the root). Can the plugin be
tweaked to do this? --[[schmonz]]
+
+> Done. --[[Joey]]
diff --git a/templates/googleform.tmpl b/templates/googleform.tmpl
index e2d4a1f43..bcf1004a4 100644
--- a/templates/googleform.tmpl
+++ b/templates/googleform.tmpl
@@ -1,6 +1,6 @@
<form method="get" action="http://www.google.com/search" id="searchform">
<div>
- <input name="sitesearch" value="<TMPL_VAR SITEFQDN>" type="hidden" />
+ <input name="sitesearch" value="<TMPL_VAR URL>" type="hidden" />
<input name="q" value="" id="searchbox" size="16" maxlength="255" type="text" />
</div>
</form>