Module:SongCategories/doc
This is the documentation page for Module:SongCategories
| This Lua module is used on many pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
This module is used by the {{Infobox song}} template to assign categories based on the |type= parameter. It processes the song type and adds appropriate categories to articles.
Usage
The module is invoked within the {{Infobox song}} template as follows:
{{#invoke:SongCategories|getCategories|type={{{type|}}}}}
The module expects a type parameter with one of the following values:
Top 10 Hit Song: Adds [[Category:Top 10 Hit songs]].No.1 Hit Song: Adds [[Category:Number One Songs]].Major Hit Song: Adds [[Category:Major Hit Songs]] and [[Category:Number One Songs]].- Any other value or empty input: No categories are added.
Example
In an article using the {{Infobox song}} template:
{{Infobox song
| name = Example Song
| type = Major Hit Song
| artist = Example Artist
| album = Example Album
| released = January 1, 2020
| genre = Pop
| rating = 4
}}
This will add the article to [[Category:Major Hit Songs]] and [[Category:Number One Songs]].
Notes
- The module is case-sensitive. Ensure the
typeparameter matches the exact values (Top 10 Hit Song,No.1 Hit Song,Major Hit Song). - If you need case-insensitive matching, the module can be modified to normalize the input (e.g., convert to lowercase).
- Ensure the categories ([[Category:Top 10 Hit songs]], [[Category:Number One Songs]], [[Category:Major Hit Songs]]) exist on the wiki to avoid redlinks.
See also
- {{Infobox song}} – The template that uses this module.
- Module:SongCertifications – Handles certification-based categories for the same template.