Jump to content

Template talk:Google custom

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

About this template

[edit]

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)[reply]

Some references to help explain the template code:
And of course see: WP:EIW#Template for detailed information about templates. --Teratornis 23:27, 3 November 2007 (UTC)[reply]
Later I wrote {{Google help desk}} to allow searching the Help desk with a shorter template syntax. {{Google custom}} remains useful for searching many different areas of Wikipedia, including particular sets of archived pages. If you need to type a large number of custom searches for a particular part of Wikipedia, use {{Google help desk}} as an example of how to create a dedicated template for one specific kind of custom search. --Teratornis (talk) 19:31, 3 March 2008 (UTC)[reply]

In case anyone wants to delete this template

[edit]

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)[reply]

Simplifying the template syntax with magic words

[edit]

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)[reply]

[edit]

The template warning message links to {{Google scholar}}:

Do not use Template:Google scholar in articles as Google links are not appropriate for an encyclopedia

--Jtir (talk) 16:08, 29 August 2008 (UTC)[reply]

Oops. That was a copy and paste error from the other template. Fixed now. Thanks for spotting this. --Teratornis (talk) 03:18, 2 September 2008 (UTC)[reply]
[edit]
Raised in response to thread at WP:VPT#Searching for forum contributions in Wikipedia forum throws goggle error message

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)[reply]

Thanks for that. I had noticed the same error recently as well, but I thought I might be having a network problem. I would say go ahead and make the fix, unless someone else knows more about this problem. --Teratornis (talk) 16:31, 12 August 2011 (UTC)[reply]
 Done --Redrose64 (talk) 16:42, 12 August 2011 (UTC)[reply]