Template:Cocktaildb recipe/doc

From Wikipedia, the free encyclopedia

This is the template documentation page for Template:Cocktaildb recipe.

This page is not necessarily intended to be viewed directly. If it uses variables, some links may appear broken. Do not replace these variables with hardcoded page names or URLs.

Cocktaildb recipe: Mixed Drinks WikiProject link to CocktailDB.com Recipes

{{Cocktaildb recipe}} is used to generate a standardized link to mixed drink recipes at CocktailDB.com. CocktailDB has been reviewed by participants of the Mixed Drinks WikiProject and several other editors at Wikipedia, and has been found to be a reliable mixed drink resource, with minimal commercial advertising.

For template or usage questions, contact Willscrlt (original template developer).

Contents

[edit] Purpose

This template should be used exclusively for mixed drink articles (i.e., cocktails), since it only links to the cocktails portion of the site. If other WikiProjects would find it useful to extend this template to include links to other sections of the site, please discuss it on this template's talk page.

By using this template instead of manually coding a link to CocktailDB's site, it will be easy to update all pages linking to CocktailDB if the CocktailDB.com site ever changes its site in a way that would normally break such links. If that happens, one change to this template should update all the links throughout Wikipedia at once.

It is important that the template is transcluded into the article, rather than substed in. Substituting breaks the dynamic connection to the template, and such pages will no longer dynamically update.

[edit] Usage

  • Go to CocktailDB and search for the cocktail to which you wish to link.
  • Click on the appropriate search result to go directly to the cocktail's page.
  • The page URL should look like http://www.cocktaildb.com/recipe_detail?id=####, where "####" is a number that represents the particular drink (the number has no significance outside of CocktailDB).
  • Copy ONLY the numerical portion of the URL indicated by #### above.
  • If one does not already exist, add a section named "External links" near the bottom of the wiki article.
  • Add the following text to the external links section as shown:
==External links==
* {{Cocktaildb recipe|id=####|name=PRETTY NAME}}
    • The asterisk (*) is to make the link be part of a bulleted list (since it's part of the list of external links).
    • "####" is the ID number you've copied from the CocktailDB URL. The ID number is required.
    • "PRETTY NAME" is the cocktail's name for display in the external link.
    • The pretty name is technically optional and defaults to the name of the article if omitted, but since pages are sometimes moved or renamed, it is best to specify the name.

[edit] Optional attributes

[edit] categories

By default, any article that uses this template is presumed to be a mixed-drink related article (otherwise use of this template in the article should be avoided). So, the article is automagically categorized under Cat:WikiProject Mixed Drinks articles, which helps to alert Project Participants to the existence of the article.

This attribute is a somewhat "hidden" feature that allows demonstrating this template in places where the automagical categorization is undesirable. Any value other than no is ignored and the category will be generated. If set to no the template will display as normal, but the category will be suppressed.

{{Cocktaildb recipe|id=####|name=PRETTY NAME|categories=no}}

[edit] info

Another somewhat "hidden" feature of this template is the automatic inclusion of the words "Information from the " prefixed to the output of this template. This is primarily for use within the {{WPMIXInfobox}} when the standardized recipe information used comes from CocktailDB. In the External links section and most other places, this would be undesirable.

The categories are automatically suppressed with this option, since the infobox adds the category, and it is silly to do so twice.

{{Cocktaildb recipe|id=####|name=PRETTY NAME|info=yes}}

[edit] Example

Searching for "Singapore Sling", you'll reach the page: http://www.cocktaildb.com/recipe_detail?id=3779

Copy "3779" from the URL and then add the following to External links in the Singapore Sling article:

* {{Cocktaildb recipe|id=3779|name=Singapore Sling}}
The result is:

To display the same information in WPMIXInfobox format, the following would be used:

* {{Cocktaildb recipe|id=3779|name=Singapore Sling|info=yes}}
The result is:

If the template is used without the required id attribute, a search link is generated instead:

* {{Cocktaildb recipe|name=Singapore Sling}}
The result is:
This is not the desirable output, and usage in this manner likely violates Wikipedia's guidelines.


[edit] Template

The generic template is displayed below.