Template talk:Infobox food

Suppress cookbook parameter

edit

It's come up before, and I'd like to formally request a way to suppress the automatic cookbook link. (I wish there were a way external links could be red.) Better to miss a few opportunities for a real link than to habitually mislead readers by pointing them to nonexistent pages on a sister project. I experienced this myself as a reader—from Sacchettoni, but I'm sure there are many examples. --BDD (talk) 00:33, 25 June 2022 (UTC)Reply

I wholeheartedly agree that the "Cookbook" link should be suppressed unless the template invocation positively indicates the desire to have that link present. (The indication could be a non-null value given for cookbook.) Most template usages have a useless link appear which dumps the user onto the page of a failed Wikibook search. - R. S. Shaw (talk) 06:30, 27 June 2022 (UTC)Reply
  Fixed --- the current version only automatically links to the cookbook if Wikidata says it exists. You can use |cookbook= to override and force a link. You can also use |no_recipe= to suppress it entirely. — hike395 (talk) 05:02, 1 August 2022 (UTC)Reply

Replace "country" parameter name

edit

The existence of the country parameter is a perennial source of nationalistic food fights all over Wikipedia, and is unhelpful in the majority of cases, where food items predate modern country boundaries. The label for the parameter was changed to Place of origin way back in 2009. It's long past time that an alternate parameter name was made available and preferred over country. I suggest place_of_origin, reflecting the label. The old name can be retained as an alternate parameter name for compatibility, or it can be deprecated and systematically replaced. --Paul_012 (talk) 01:47, 19 August 2022 (UTC)Reply

Also, national_cuisine could be replaced with associated_cuisine, as it only needs to link to a Fooian cuisine article, and there are such articles (e.g. Mediterranean cuisine, Cajun cuisine) whose scope isn't strictly national. --Paul_012 (talk) 01:50, 19 August 2022 (UTC)Reply

  Done --- template now accepts |place_of_origin= as well as |associated_cuisine=. — hike395 (talk) 13:36, 22 August 2022 (UTC)Reply

Semi-protected edit request

edit

Under the Parameter definitions, for place of origin, please state that it typically means country of origin in parenthesis. 2600:100C:A210:2BB2:D065:41F0:97B6:9328 (talk) 21:38, 10 January 2023 (UTC)Reply

  Not done for now: please establish a consensus for this alteration before using the {{Edit template-protected}} template. This parameter has been populated with a variety of place names. See the Template Data monthly report (scroll to place_of_origin and click "Click to show") for a list. – Jonesey95 (talk) 21:58, 10 January 2023 (UTC)Reply

Template-protected edit request on 12 January 2023

edit

Description of suggested change:

Disclaimer: I am not fluent in Template syntax.

Currently, both the parameters "creator" and "creators" are accepted. However, when only "creators" is specified, the check for unknown parameters still shows an error, claiming "creators" is not a known parameter.

I am guessing (not being familiar with the unknown parameters check), that this is due to "creators" not being listed in the call to

{{#invoke:check for unknown parameters...

I suppose adding "creators" to the list of parameter names will fix this (but once again, I don't know how this code handles "both parameters are supported" type parameters).

Diff:

Old:

{{#invoke:check for unknown parameters|check
|unknown={{main other|[[Category:Pages using infobox food with unknown parameters|_VALUE_]]}}
|preview=unknown parameter "_VALUE_"
|alt|alternate name|alternate_name|associated_cuisine|belowstyle|calories|calories_ref|caption|carbohydrate|commons|cookbook|country
|course|creator|fat|glycemic_index|image|image_alt|image_size|main_ingredient|maxtime|minor_ingredient|mintime
|name|name_italics|name_lang|national_cuisine|no_commons|no_recipes|other|place_of_origin|protein|qid|region|served|serving_size

|similar_dish|time1|time2|type|variations|year}}

New:

{{#invoke:check for unknown parameters|check
|unknown={{main other|[[Category:Pages using infobox food with unknown parameters|_VALUE_]]}}
|preview=unknown parameter "_VALUE_"
|alt|alternate name|alternate_name|associated_cuisine|belowstyle|calories|calories_ref|caption|carbohydrate|commons|cookbook|country
|course|creator|creators|fat|glycemic_index|image|image_alt|image_size|main_ingredient|maxtime|minor_ingredient|mintime
|name|name_italics|name_lang|national_cuisine|no_commons|no_recipes|other|place_of_origin|protein|qid|region|served|serving_size

|similar_dish|time1|time2|type|variations|year}}

RudolfSchreier (talk) 09:33, 12 January 2023 (UTC)Reply

  Donehike395 (talk) 12:13, 12 January 2023 (UTC)Reply

Image size

edit

Should this template use

| image_upright =

instead of

| image_size =

Or could we allow both? I'm wondering because of what I'm reading at MOS:IMAGESIZE. Valereee (talk) 14:47, 13 May 2024 (UTC)Reply

This template should certainly support |image_upright=. There are 2,951 articles using |image_size=, so it should continue to be supported for now but use should be deprecated. Plantdrew (talk) 16:24, 13 May 2024 (UTC)Reply
Plantdrew, apologies for my ignorance -- are you saying we should add |image_upright= to this template, and start going through articles to change the use of |image_size= to |image_upright= (and maybe insert a hidden comment that image-size should not be used?) so that we can remove it sometime in the future? Valereee (talk) 16:29, 13 May 2024 (UTC)Reply
I've marked |image_size= as deprecated at Template:Infobox food/TemplateData. We should add |image_upright= to this template. 16:43, 13 May 2024 (UTC) Plantdrew (talk) 16:43, 13 May 2024 (UTC)Reply
  Done. Template accepts either |upright= or |image_upright=. Default value is now |upright=1hike395 (talk) 17:17, 13 May 2024 (UTC)Reply
Thank you both! Valereee (talk) 17:19, 13 May 2024 (UTC)Reply

Broken parameter in "Semla"

edit

Greetings and felicitations. In the article semla the Commons link is broken. I've checked both the infobox there and the Wikidata item, and have found nothing obviously amiss at either place. Would someone else please be so kind as to take a look? —DocWatson42 (talk) 05:42, 4 October 2024 (UTC)Reply

  Fixed It's because the name parameter used {{lang}}. I removed the template and that fixed the problem. — hike395 (talk) 05:58, 4 October 2024 (UTC)Reply
Thank you. ^_^ —DocWatson42 (talk) 05:59, 4 October 2024 (UTC)Reply

Edit request 27 December 2024

edit

|alternate name= (alias with a space) is no longer used anywhere and can be deleted.

  Donehike395 (talk) 13:11, 27 December 2024 (UTC)Reply

calories

edit

The instructions say to use a plaintext number to allow for automatic conversion, which works. However, it doesn't work with a range of values, simply appending the range with "kcal". Additionally, however, if somebody wants to use {{convert}} to get around that, the infobox will automatically append the kcal, anyway. If it's not possible to automatically convert ranges in that variable, could it be adjusted to, if it sees a {{convert}} in the variable, not automatically append the "kcal"? — Fourthords | =Λ= | 23:00, 17 March 2025 (UTC)Reply

  Fixed -- now using the convert template: if it fails to convert, simply uses the parameter as provided (so you can call {{convert}} yourself) — hike395 (talk) 00:53, 18 March 2025 (UTC)Reply
Wow, that's awesome! Thanks so much! — Fourthords | =Λ= | 01:18, 18 March 2025 (UTC)Reply
@Fourthords: You can use a dash argument, e.g., 223–400, and the infobox will do the range conversion for you. — hike395 (talk) 04:43, 18 March 2025 (UTC)Reply

Template-protected edit request on 30 May 2025

edit

Add ability to embed other templates at the bottom of this infobox. Think this will be relatively uncontroversial; it's a standard feature in I'd say the majority of other major infoboxes. The reason I want it is because {{Infobox Korean name/auto}} is often embedded in other infoboxes.

Ctrl+f to locate the below statement:

}}}}{{#invoke:check for unknown parameters

change the above snippet to this:

}} {{{module|}}} }}{{#invoke:check for unknown parameters


I tested this out in the sandbox and confirmed that it works. Note that this places the embedded template right below the commons links at the bottom of the infobox. Open to negotiation; we could move it above those icons, but I figure those icons are probably more relevant to the rest of the content of the infobox, and placing foreign text infoboxes in between them kinda interrupts the flow. grapesurgeon (seefooddiet) (talk) 22:49, 30 May 2025 (UTC)Reply

Why at the very bottom? Why not set |data37={{{module|}}}, which would be more standard? — hike395 (talk) 02:04, 31 May 2025 (UTC)Reply
Provided reasoning in my OP, but it's not something I'm confident in. I'd be open to your suggestion as well. grapesurgeon (seefooddiet) (talk) 10:27, 31 May 2025 (UTC)Reply
  Done. See the testcases page. – Jonesey95 (talk) 13:59, 31 May 2025 (UTC)Reply

Calories with any text

edit

A recent change to the template calls {{convert}} using #iferror to test if the convert works. That's fine, but an ugly side effect (from my point of view) concerns the result that there are now 31 articles at WhatLinksHere for Module:Convert/extra. That module contains experiments for units that have not yet been incorporated into convert. WhatLinksHere is useful to see where temporary units are used and it would be much cleaner if junk entries resulting from {{Infobox food}} were not present. These entries occur when calories is something other than a plain number. For example, Rich tea has entry |calories = 38 (per biscuit) which results in convert trying to process something that is not a number. Convert gets confused and invokes Module:Convert/extra. I haven't thought of a good way of handling this but a possibility is something like what is done in {{Chembox}}. If the MeltingPtC entry is used, the given value is a number in °C and convert is called to give °F and °K values. Sometimes no simple number can be given, in which case the MeltingPt entry is used—it accepts any text and does not try to convert it. If a new parameter like calories_notes were available, I could periodically fix entries by changing parameter calories to calories_notes. Or, I might think of some other solution. At any rate, I'm putting this here for ideas. Johnuniq (talk) 10:46, 31 May 2025 (UTC)Reply