Template talk:Google books

(Redirected from Template talk:Google books/sandbox)
Latest comment: 2 years ago by FeRDNYC in topic Google book tool erroring out

WT:CITE#Linking to Google Books pages

edit

RfC on whether WP:CITE should say Google Books page links are not required but are allowed in footnotes, and that editors should not go around removing them. All input welcome. SlimVirgin talk|contribs 20:35, 29 October 2010 (UTC)Reply

Certainly should have links. — LlywelynII 02:09, 10 September 2011 (UTC)Reply
I personally agree (at least as long as a preview is available and allows easy verification of related WP content), but not every author sees it that way. Another issue is Google does not guarantee that the book or the cited pages stay visible. In practice in many cases it is relatively stable, but not always and an additional drawback is that the visibility might depend on your country.--Kmhkmh (talk) 11:50, 10 September 2011 (UTC)Reply

Template needs work

edit

No space for author, year of publication, date of access/retrieval, etc. See WP:CITE/ES. — LlywelynII 02:09, 10 September 2011 (UTC)Reply

Also no need to place obnoxious, distracting "at Google Books". Template already creates link. — LlywelynII 02:22, 10 September 2011 (UTC)Reply

As I understand it the purpose of this template to merely provide a Google books link to a specific page and not to be (an often messy and much more comprehensive) citation template and to stay away from the "true citation (template)" wars. In other words this is not a citation template, but a template that allows people not using citation templates to provide useful (page based) online links nevertheless. For that reason imho there is no point in extending with your suggested entries, because for that we already have citation templates.

Where I would tentatively agree however is that the "at Google Books" part could be removed or at least made optional.--Kmhkmh (talk) 11:45, 10 September 2011 (UTC)Reply

Compare it with Template:Gutenberg, which does allow full citations. Horatio (talk) 07:29, 28 April 2013 (UTC)Reply

Emit page number

edit

The template accepts a parameter |page= Should it then not also emit that page number? E. g.

History of the Western Insurrection, p. 42, at Google Books

I think the necessary template code would look like

''[http://books.google.com/books?id={{{1|{{{id}}}}}}{{#if:{{{page|}}}|&pg=PA{{{page|}}}|}} {{{2|{{{title|{{PAGENAME}}}}}}}}]''{{#if:{{{page|}}}|, p. {{{page|}}},|}} at [[Google Books]]

but I'm not exactly a template expert. -- Michael Bednarek (talk) 12:45, 30 August 2012 (UTC)Reply

Proposed changes in Template:Google books/sandbox and Template:Google books/testcases

edit

Hi everyone, there are two changes I've made in the template sandbox. One displays the page number after the url if one was passed to the template; it was suggested by Michael Bednarek. The other is a result of the nomination of {{gbook}} for merging—it allows this template to return only a bare url and nothing else (which is to replace {{gbook}}). Thanks, RainCity471 (whack!) 08:11, 21 October 2013 (UTC)Reply

Thanks; however, instead of surrounding the page number with parentheses, I prefer commas around it. -- Michael Bednarek (talk) 13:02, 21 October 2013 (UTC)Reply
That's fine, it probably does look better that way. I'll copy the sandbox changes to the main template now. Thanks, RainCity471 (whack!) 19:59, 22 October 2013 (UTC)Reply
These changes are causing URL errors to appear in citations where there were no errors before. See, for example: [1] and [2]. Please fix this problem if you are able.Jonesey95 (talk) 03:37, 23 October 2013 (UTC)Reply
If a plain URL is required, specifying |plainurl=yes (which needs to be documented) will do that. From your 1st example:
* {{cite book|title=System der Asteriden|url={{google books|SDwb-runOSQC|System der Asteriden|page=PR5|plainurl=yes}}|publisher=Friedrich Vieweg und Sohn |location=Braunschweig}} (1842) with [[Franz Hermann Troschel|F. H. Troschel]] will produce
  • System der Asteriden. Braunschweig: Friedrich Vieweg und Sohn. (1842) with F. H. Troschel
It seems to me that the previous use of {{Google books}} in your examples for the parameter |url= in the template {{Cite book}} was bending the concept of a URL quite a bit. -- Michael Bednarek (talk) 04:23, 23 October 2013 (UTC)Reply
This change is indeed causing CS1 URL scheme errors. Ex: Gold standard. — JJJ (say hello) 14:39, 25 October 2013 (UTC)Reply
I guess I'm the person who mucked up... My understanding was that the template would never have worked in citation templates anyway, since it always returned the formatted url and I just added an option for it to return a plain one... Anyway shall I undo it? RainCity471 (whack!) 18:21, 25 October 2013 (UTC)Reply
No, this does not need to be reverted. I was worried that there would be tons of google books templates in citations, but the job queue appears to be adding them to Category:Pages with URL errors at a rate of only about one or two a day, which is easy to keep up with. – Jonesey95 (talk) 21:51, 25 October 2013 (UTC)Reply
Ok, I'm afraid i don't know why the job queue is doing this. I guessed I was safe because I thought the template would never have worked in citation templates anyway; I considered all I was doing was adding an option to change the output and it wouldn't affect the default (this is disregarding the change that added the page number; that only added to the title and can't have affected this). It was my fault I forgot to document the change—I sort of remembered a bit later and then forgot. If for some reason the job queue spits out a load of broken templates, ask me and I'll be happy to help. Sorry, RainCity471 (whack!) 22:39, 26 October 2013 (UTC)Reply
The job queue is a background process that, among other things, recategorizes articles when one of the templates contained ("transcluded", in WP jargon) within the article causes that article to be added to or removed from a category. The job queue effectively performs a null edit on each article, "refreshing" it. It appears to be taking 3-4 weeks to travel through all of Wikipedia these days, so if it adds one or two a day, that means about 30-40 articles will pop up with errors. That's not a problem; human editors create a lot more problems than that.
Is somebody here going to change the 10 or so articles that use {{gbook}} to use this template instead? – Jonesey95 (talk) 23:30, 26 October 2013 (UTC)Reply
I understand about the job queue and will try and sort the {{gbook}}s soon. RainCity471 (whack!) 21:41, 2 November 2013 (UTC)Reply

How to deal with "roman" page numbers and front matter?

edit

If instead of using &PA=n one uses &PR=n this will link to pages number using roman numerals. Also, I just found you can even use &PP=n for pages before the roman numerals start. Taking the example from the template documentation:

  • {{Google books|7ydCAAAAIAAJ|History of the Western Insurrection|page=42|plainurl=yes}}

yields

However, if one links to //books.google.com/books?id=7ydCAAAAIAAJ&pg=PP2, this is the bookplate on the inside cover, and //books.google.com/books?id=7ydCAAAAIAAJ&pg=PR1 is the title page complete with inscriptions. What would be the best way to incorporate these modes of use into the template? —Phil | Talk 12:58, 21 May 2014 (UTC)Reply

keywords

edit

Can we add a keyword search parameter? I want to generate a URL something like

https://books.google.com/books?id=3rREAAAAYAAJ&q=cumana+landcruiser

I am a professional programmer who is used to WP templates, so I don't mind doing the work myself.  Stepho  talk  02:12, 26 August 2015 (UTC)Reply

Example 1 at Google Books (using |text=)
Example 2 at Google Books (using |keywords=)
User:Stepho-wrs, added |keywords=. it looks like there is already an undocumented |text=. not sure if that does anything useful. Frietjes (talk) 13:07, 12 September 2015 (UTC)Reply
|text= emits …&dq="text" which works for searching a "direct quote". I have added it to the documentation. HTH HAND —Phil | Talk 13:00, 29 April 2016 (UTC)Reply

Should ignore spaces

edit

Most templates ignore spaces before the "|" when specifying parameters, but this template does not. When I enter {{Google books |1T4ORu6EICkC |page=124 |plainurl=yes}} the URL generated has a space before &pg=PA124 which is an invalid URL. It causes further problems when using the template within another template after the parameter |url=. Can someone fix the template to ignore extra spaces within the generated URL? Thanks. CuriousEric 20:10, 15 October 2017 (UTC)Reply

I have adjusted the template to trim whitespace from the id. Here's what it looks like now: https://books.google.com/books?id=1T4ORu6EICkC&pg=PA124.
Let me know if I have broken anything. – Jonesey95 (talk) 20:50, 15 October 2017 (UTC)Reply
P.S. I tried in the sandbox to elegantly trim whitespace from the whole URL, but it doesn't work for me. – Jonesey95 (talk) 20:58, 15 October 2017 (UTC)Reply
Triming the whitespace seems to work fine now in the mainline template, both before and after the "|". I am not familiar with testing in the sandbox. CuriousEric 01:41, 16 October 2017 (UTC)Reply

Two-page

edit

Needs to support two-page view. Google Books param is "v=twopage" Mikus (talk) 21:37, 27 September 2019 (UTC)Reply

edit

An error in the documentation « |text= searches for a quoted phrase (corresponding to the dq parameter in the Google URL) ». That's not true. The Google Book URL's dq parameter is a mystery, not explained in the Google API documentation or any other part. Testing with a few URL, I suppose that dq is something like a « direct search » (from Google Search or Google Books main page) as opposed to q modified by the search formular of a preview (javascript).

The "quoted search" works with quotes in URL : as in &q="fu bar". Same as Google Search. So the template text param may have to generate an URL with q="bla" or dq="bla" (but not dq=bla).

Irønie (talk) 12:16, 26 March 2020 (UTC)Reply

Google book tool erroring out

edit

The Google book tool link provided in the template's documentation leads only to an error page, for me:

Error: Server Error

The server encountered an error and could not complete your request.

Please try again in 30 seconds.

I will try again, as suggested, but my hopes are not high. (Correctly, as it turns out, because a reload after ~60 seconds produced the same message.) Though, the error page does still have a favicon that would seem to represent the tool in question.

For others who have more experience with the tool, is this a common issue with it? Are outages temporary, or likely to be longer-term? Should the link be removed from the documentation? (And in the foolish-optimism department: Does anyone have any replacement links to similar, but currently functioning, tools?)

I now see that appspot.com itself redirects to the Google Cloud Platform management console, which makes me even more concerned that the tool previously available at reftag.appspot.com is gone forever. FeRDNYC (talk) 08:28, 14 January 2022 (UTC)Reply

Never mind — Citer, developed by Dalba, is a much better tool that accepts more types of URLs/identifiers, and it runs on the Wikimedia toolforge. I'll update the template docs to point there instead. FeRDNYC (talk) 09:34, 14 January 2022 (UTC)Reply