Module:SongCategories/doc

Revision as of 00:24, 11 June 2025 by Kingwarz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the documentation page for Module:SongCategories

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 type parameter 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