This is the
talk page for discussing improvements to the
Google custom template. |
|
Google Template‑class | ||||||||||||||
|
I wrote the initial revision of {{ Google custom}} by editing the already-existing {{ Google}} template. Instead of generating links to search the entire Web, as {{ Google}} does, {{ Google custom}} generates links to search single Web sites (or portions thereof). As should be obvious from the examples I gave in the template documentation, this is useful for searching particular collections of pages on Wikipedia, such as the Help desk archive pages. I wrote this template primarily to help with answering questions on the Help desk. Help desk questions are repetitive, so it is nice to have a template with reasonably compact syntax that lets us generate searches on the Help desk archives to include with our answers. The template may be useful in other discussions, for example when someone wants to search within the multiple pages of one particular online manual. -- Teratornis 23:19, 3 November 2007 (UTC)
Template talk:Google#TfD nomination of Template:Google lists a deletion discussion for {{ Google}}; the result was "keep." {{ Google custom}}'s existence should be justifiable on the same basis, since both templates work similarly, with {{ Google custom}} adding more options to generate a Google custom search form. {{ Google custom}} displays the same warning that {{ Google}} displays when an editor attempts to use it in an article; thus the template should be robust against that form of misuse. -- Teratornis 23:19, 3 November 2007 (UTC)
When using {{ Google custom}} to search namespaces or subpage trees on Wikipedia, one can avoid having to copy the appropriate chunk of URL-encoded site and page identifier by using some tricks from Help:Magic words#Namespaces and URLs and Help:Variable#Constants. Compare the following two equivalent template expressions, which search Wikipedia talk:Help desk and its subpages:
Type this | To get this | What it produces, or searches for |
---|---|---|
{{Google custom|{{SERVERNAME}}{{localurl:Wikipedia talk:Help desk}}||Search Wikipedia talk:Help desk and its archives}} |
Search Wikipedia talk:Help desk and its archives | Blank form to search the Wikipedia Help desk talk page and its archives |
{{Google custom|en.wikipedia.org/wiki/Wikipedia_talk:Help_desk||Search Wikipedia talk:Help desk and its archives}} |
Search Wikipedia talk:Help desk and its archives | Blank form to search the Wikipedia Help desk talk page and its archives |
Unfortunately, the "simplified" syntax tends to be a little longer. I might try modifying {{
Google custom}} to detect when the second argument is the title of a page on Wikipedia which exists (see:
m:Help:ParserFunctions#.23ifexist:), rather than a chunk of a URL. If the argument is a page title (such as Wikipedia talk:Help desk
, then the template could automatically convert it into the URL chunk that the Google customer search requires. Then {{
Google custom}} would correctly handle simpler expressions like this:
{{Google custom|Wikipedia talk:Help desk||Search Wikipedia talk:Help desk and its archives}}
-- Teratornis ( talk) 06:24, 21 April 2008 (UTC)
The template warning message links to {{ Google scholar}}:
-- Jtir ( talk) 16:08, 29 August 2008 (UTC)
The links generated by this template do not work in each case that I've tried. That is to say, I cannot find any working cases, but may not have tested every possibility. Consider the
WP:PUMP page, try the "search" links in the five boxes below the "Village pump sections" heading. Each of these fails with the error "We're sorry... ... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now. See Google Help for more information.". I have found that this may be fixed simply by altering the base URL on the {{
Google custom}}
template from http://www.google.com/custom?domains=
to http://www.google.com/search?domains=
Is this acceptable as a general change? -- Redrose64 ( talk) 11:45, 12 August 2011 (UTC)