| This is a documentation subpage for Module:Music chart. It may contain usage information, categories and other content that is not part of the original module page. |
| This Lua module is used on approximately 78,000 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 rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected. |
This module powers the chart templates: {{Single chart}}, {{Album chart}}, {{Year-end single chart}}, and {{Year-end album chart}}.
It generates table rows with chart name, reference, and peak position for music releases. Chart data is stored in four distinct JSON pages, allowing easy maintenance without editing Lua code.
Charts output
editArchitecture
editJSON pages
edit| Page | Purpose |
|---|---|
| Module:Music chart/single.json | Weekly single chart definitions (formatting schema included) |
| Module:Music chart/album.json | Weekly album chart definitions |
| Module:Music chart/year-end-single.json | Year-end single chart definitions |
| Module:Music chart/year-end-album.json | Year-end album chart definitions |
Helpers for individual charts:
- Module:Music chart/chartdata-czech.json — week ID lookup table for Czech/Slovak charts (ifpicr.cz)
Template integration
editEach template calls the module with a type parameter that determines which JSON page to load:
<!-- Template:Single chart -->
<includeonly>{{#invoke:Music chart|main|type=single}}</includeonly>
<!-- Template:Album chart -->
<includeonly>{{#invoke:Music chart|main|type=album}}</includeonly>
<!-- Template:Year-end single chart -->
<includeonly>{{#invoke:Music chart|main|type=year-end-single}}</includeonly>
<!-- Template:Year-end album chart -->
<includeonly>{{#invoke:Music chart|main|type=year-end-album}}</includeonly>
All arguments from template calls are passed automatically. For example:
{{Single chart|Australia|1|artist=Beyoncé|song=Halo|access-date=January 1, 2025}}
The module receives: 1=Australia, 2=1, artist=Beyoncé, song=Halo, access-date=January 1, 2025, type=single.
Output structure
editThe template produces two table cells and a reference:
| Chart Name (Provider)<ref name="refname">"[url url_title]". lang. ref. ref_note. Retrieved access-date.</ref>
| style="text-align:center;"| Position
With rowheader=true:
! scope="row"| Chart Name (Provider)<ref>...</ref>
| style="text-align:center;"| Position
With note parameter:
| Chart Name (Provider)<ref>...</ref><br>''<small>Note text</small>''
| style="text-align:center;"| Position
Template parameters
editParameters passed to the template are used as placeholders in URL and title templates.
Common parameters
edit| Parameter | Description |
|---|---|
1 (chart) | Chart key (required). Must match a key in JSON data. |
2 (position) | Peak position on the chart (required). Must be a number 1–200 or dash (–) for not charted. |
3 | Set to M for manual reference mode. |
artist | Artist name. |
song / album | Song or album title (depending on chart type). |
year, week | Chart week identifiers. week accepts 1–53 or combined weeks like 51+52. |
date | Chart date (format depends on chart). |
songid, artistid, chartid, id | Numeric IDs for some charts. |
url, title | For charts requiring user-provided URL. |
access-date | Date when source was accessed. |
publish-date | Publication date of the source (shown in reference for year-end charts). |
archive-url, archive-date | Archive link and date for archived sources. |
refname | Custom reference name (overrides auto-generated). |
rowheader | Set to true to output chart name as row header. |
note | Additional note displayed below chart name in small italic text. |
refgroup | Reference group name for grouping footnotes (e.g., lower-alpha). |
dvd | DVD/video title (alternative to album for music video charts). |
Computed placeholders
editDerived automatically from the date parameter. All formats work with any input date format (YYYY-MM-DD, YYYYMMDD, YYMMDD, DD-MM-YYYY, DD.MM.YYYY):
| Placeholder | Output format | Example (any input → output) |
|---|---|---|
{dateDigits} | YYYYMMDD (digits only) | 20240115 |
{dateMDY} | Month Day, Year | January 15, 2024 |
{dateDMY} | DD.MM.YYYY | 15.01.2024 |
{dateYMD} | YYYY-MM-DD | 2024-01-15 |
{dateSlash} | D/M/YYYY (no leading zeros) | 15/1/2024 |
{dateYear} | YYYY | 2024 |
Manual reference mode
editFor special cases where automatic URL generation doesn't work, use manual mode by setting the third parameter to M:
{{Single chart|Australia|1|M
|url=https://example.com/custom-source
|title=Custom Source Title
|work=Billboard
|date=January 1, 2025
|access-date=January 5, 2025
}}
Manual mode:
- Requires
urlandtitleparameters - Generates reference using {{cite news}} format
- Supports additional params:
work,location,publisher,date,archive-url,archive-date,url-status - Uses same chart name and provider from JSON
JSON data format
editEach JSON page contains chart definitions grouped by country/region. The structure is:
{
"_schema": { ... },
"CountryGroup1": {
"ChartKey1": { ... },
"ChartKey2": { ... }
},
"CountryGroup2": {
"ChartKey3": { ... }
}
}
Keys starting with _ (like _schema) are ignored by the module and can be used for documentation.
Basic chart entry
edit{
"Australia": {
"Australia": {
"chart": "Australia",
"provider": "[[ARIA Charts|ARIA]]",
"url": "https://australian-charts.com/showitem.asp?interpret={artist}&titel={song}&cat=s",
"url_title": "{artist} – {song}",
"ref": "[[ARIA Charts|ARIA Top 50 Singles]]."
},
"AustraliaKent": {
"chart": "Australia",
"provider": "[[Kent Music Report]]",
"ref": "{{cite Kent|page={page}}}"
}
}
}
Note: If chart is omitted, the country group name is used as the chart name.
Core fields
edit| Field | Required | Description | Example |
|---|---|---|---|
chart | No | Display name for the chart. Defaults to country group name. | "Australia" |
provider | No | Provider name shown in parentheses after chart name. Supports wikilinks. | "ARIA" |
url | Yes* | URL template with {placeholders}. If starts with [, treated as pre-built wikilink. | "https://example.com/{artist}" |
url_title | Yes* | Link title template. Combined with URL as "[url title]". | "{artist} – {song}" |
ref | Yes* | Reference text shown after URL. Supports wikilinks and templates. | "ARIA Charts." |
lang | No | Language note inserted between URL and ref. | "(in German)" or "(in German)" |
* At least ref is required. url and url_title are required for charts with links.
URL encoding
editThe encode field controls how text parameters ({artist}, {song}, {album}, {dvd}) are encoded in URLs. Other parameters (IDs, dates, numbers) are not affected. It's an array of operations applied in fixed order.
| Operation | Description | Example |
|---|---|---|
normalize | Remove diacritics (accents). Converts é→e, ñ→n, ü→u, etc. Use for sites like Billboard that don't support accented characters in URLs. | Céline → Celine |
ansi | Latin-1 (ISO-8859-1) encoding instead of UTF-8. Encodes é as %E9 (single byte) instead of %C3%A9 (UTF-8). Use for legacy sites like Hung Medien. | Céline → C%E9line |
lower | Convert to lowercase | The Beatles → the beatles |
clean-symbols | Remove special characters. Keeps only letters (a-z, A-Z), numbers (0-9), and dashes (-). Spaces become dashes. Symbols between digits become dashes (e.g., 2.0 → 2-0). | 20/20 Experience! → 20-20-experience |
space-plus | Replace spaces with +, full URL encoding. This is the default — only specify explicitly in multiple entries when overriding a different chart-level space setting. | The Beatles → The+Beatles |
space-dash | Replace spaces with -, encode only non-ASCII. Preserves ASCII symbols like $, '. Use for Billboard and similar sites. | A$AP Rocky → A$AP-Rocky |
space-url | Replace spaces with %20 (standard URL encoding) | The Beatles → The%20Beatles |
Order in array doesn't matter — operations are always applied in this sequence: normalize → lower → clean-symbols → space replacement → URL encoding.
Entry-level encode: The encode field can also be set in multiple entries to override the chart-level setting for specific URL variants.
Examples:
| encode | Input | Output |
|---|---|---|
| (not specified) | The Beatles | The+Beatles |
["ansi"] | Céline Dion | C%E9line+Dion |
["space-dash"] | The Beatles | The-Beatles |
["space-dash"] | A$AP Rocky | A$AP-Rocky |
["space-url"] | The Beatles | The%20Beatles |
["normalize", "space-dash"] | Céline Dion | Celine-Dion |
["normalize", "lower", "clean-symbols", "space-dash"] | 20/20 Experience! | 20-20-experience |
["ansi", "space-dash"] | Céline Dion | C%E9line-Dion |
Date validation
editThe date_format field specifies expected date format. If provided, the module validates user input and shows error for invalid dates.
| Format | Pattern | Example |
|---|---|---|
YYYY-MM-DD | 4-2-2 digits with dashes | 2024-01-15 |
YYYYMMDD | 8 digits | 20240115 |
DD-MM-YYYY | 2-2-4 digits with dashes | 15-01-2024 |
MM-DD-YYYY | 2-2-4 digits with dashes | 01-15-2024 |
DD.MM.YYYY | 2-2-4 digits with dots | 15.01.2024 |
YYMMDD | 6 digits | 240115 |
DD.MM.YYYY–DD.MM.YYYY | Date range with dots | 15.01.2024–21.01.2024 |
YYYY.MM.DD–YYYY.MM.DD | Date range with dots (Korean) | 2024.01.15–2024.01.21 |
YYYYMMDD-YYYYMMDD | Date range | 20240115-20240121 |
Date range separators: For date range formats, the module accepts en-dash (–), hyphen (-), and tilde (~) as separators. In the params column of showCharts output, all separators are displayed as hyphen for consistency.
Use date_format_alt to accept an alternative format.
Year and week validation
editThe module also validates year and week parameters when provided:
yearmust be exactly 4 digits (e.g.,2024)weekmust be 1–2 digits (e.g.,1,03,52) or combined format like51+52
If the parameter is used in URL construction (critical), an error is shown in red and the page is added to tracking category. If only used in reference text, a warning is shown in preview mode only.
Other fields
edit| Field | Description |
|---|---|
defunct | Set true for inactive charts or individual multiple variants. Adds tracking category and highlights the affected row in showCharts. |
alias_for | Variant to another chart key. Entry should contain ONLY this field. Should gradually be replaced with the main ones and deleted. |
ref_note | Note/instruction shown AFTER ref in standard mode, or as prefix in combine mode. Can be overridden in multiple entries. |
ref_suffix | Text added AFTER "Retrieved date" in reference. Useful for additional notes that should appear at the very end. |
refname_format | Custom ref name format with placeholders. Supports {param|default} syntax. |
url_validation | Required substring in user-provided URL. Shows error "Invalid URL. Required domain: X." if missing. |
track_param | Parameter name to track. Creates category if parameter is missing. |
number_one_category | Category added when position equals 1. |
category_conditions | Array of conditional categories. Each element: {"when": "condition", "category": "Category name"}. See Condition syntax. All matching conditions add their category. |
doc_note | Documentation note shown in showCharts table (when notes=yes). Can be set at chart level or in individual multiple entries. |
Note: Punctuation (periods) between reference parts is added automatically by the module. Do not include trailing periods in ref, ref_note, or ref_suffix values in JSON.
Multiple URL variants
editFor charts that have different URL structures depending on available parameters, use the multiple array:
{
"Denmark": {
"chart": "Denmark",
"provider": "[[Hitlisten|Tracklisten]]",
"multiple": [
{
"when": "year, week",
"url": "http://hitlisten.nu/default.asp?w={week}&y={year}&list=t40",
"url_title": "Track Top-40 – Hitlisten.NU",
"lang": "(in Danish)"
},
{
"when": "artist, song",
"url": "https://danishcharts.dk/showitem.asp?interpret={artist}&titel={song}&cat=s",
"url_title": "{artist} – {song}"
}
],
"ref": "[[Hitlisten|Tracklisten]]."
}
}
The module checks entries in order and uses the first one where when condition matches.
Condition syntax
edit| Syntax | Meaning | Example |
|---|---|---|
param | Parameter exists and is not empty | "when": "year" |
!param | Parameter is missing or empty | "when": "!url" |
param=value | Parameter equals specific value | "when": "type=remix" |
param<value | Parameter is less than value (numeric) | "when": "year<1987" |
param>value | Parameter is greater than value (numeric) | "when": "year>2000" |
param<=value | Parameter is less than or equal (numeric) | "when": "year<=2002" |
param>=value | Parameter is greater than or equal (numeric) | "when": "year>=2003" |
date<value | Date/year is less than value | "when": "date<2021-07-01" |
archivedate<value | Archive date/year is less than value | "when": "archivedate<2021-07-01" |
year+week<=2016+34 | Compact combined year/week or year/month comparison | "when": "year+week<=2016+34" |
year..., week... | Adjacent same-operator year/week or year/month comparisons in one AND chain are also treated as one combined boundary | "when": "year>2016, week>34" |
a, b | AND — all conditions must match | "when": "year, week" |
a | b | OR — any condition must match | "when": "artist | song" |
helper=value | Helper function returns specific value | "when": "helper=my_value" |
| (empty) | Default fallback — always matches | "when": "" |
Notes:
- Conditions are checked in order; first match wins (for
multiple) - For
category_conditions, ALL matching conditions add their categories - Numeric comparisons convert values to numbers; non-numeric values become 0
- For
date,archivedate, andarchive-date, comparisons use fullYYYY-MM-DDwhen the compared value is in ISO format; otherwise they compare by year - Compact comparisons like
year+week<=2016+34andyear+month>=2023+7are supported directly - Adjacent
year+weekandyear+monthcomparisons inside one AND chain are also treated as combined comparisons when both parts use the same operator - The
positionparameter is available incategory_conditions
Examples:
{ "when": "date>2021-07-01" }
{ "when": "archivedate<=2021-12-31" }
{ "when": "year+week>2016+34" }
{ "when": "year+week>2016+34, year+week<=2016+42" }
{ "when": "year+month>=2023+7" }
These examples mean, respectively: after a full ISO date boundary, on/before an archive date boundary, after 2016 week 34, within the 2016w35-2016w42 range, and from July 2023 onward.
Entry overrides
editEach entry in multiple can override these fields from the parent chart:
url,url_title,encoderef,ref_note,langprovider,chartdefunctrefname_formatdate_format,date_format_altdoc_note(for showCharts documentation)
Example: Different chart names by year
Some charts changed names over time. Use multiple with year conditions to override chart:
{
"Billboarddanceclubsongs": {
"chart": "US [[Dance Club Songs]]",
"provider": "''[[Billboard (magazine)|Billboard]]''",
"url": "https://www.billboard.com/artist/{artist}/chart-history/DSI",
"url_title": "{artist} Chart History (Dance Club Songs)",
"ref": "''[[Billboard (magazine)|Billboard]]''",
"encode": ["lower", "space-dash"],
"multiple": [
{"when": "year<1987", "chart": "US [[Hot Dance Club Play]]"},
{"when": "year<2003", "chart": "US [[Hot Dance Music/Club Play]]"}
]
}
}
This outputs:
- Before 1987: "US Hot Dance Club Play (Billboard)"
- 1987–2002: "US Hot Dance Music/Club Play (Billboard)"
- 2003+: "US Dance Club Songs (Billboard)" — uses default
chartfrom parent
The module checks entries in order. If no when matches, it uses the parent chart's values.
Use ref_note in entries for conditional notes (e.g., instructions for old chart entries):
{
"Germany": {
"chart": "Germany",
"provider": "[[GfK Entertainment charts|GfK]]",
"url": "https://www.offiziellecharts.de/titel-details-{songid}",
"url_title": "Offizielle Deutsche Charts",
"lang": "(in German)",
"ref": "[[GfK Entertainment charts]]",
"multiple": [
{"when": "year<1977", "ref_note": "To see the peak chart position, click 'TITEL VON', followed by the artist's name"}
]
}
}
In showCharts table, conditional overrides are shown inline: [year<1977 → ref_note text]
Combine mode
editSet "combine": true to include ALL matching entries as a bullet list in one reference:
{
"Finland": {
"chart": "Finland",
"provider": "[[The Official Finnish Charts|Suomen virallinen lista]]",
"ref_note": "The first is domestic singles, the second is foreign:",
"multiple": [
{
"url": "http://www.ifpi.fi/tilastot/myydyimmat/{year}/kotimaiset/singlet",
"url_title": "Myydyimmät kotimaiset singlet vuonna {year}",
"lang": "(in Finnish)"
},
{
"url": "http://www.ifpi.fi/tilastot/myydyimmat/{year}/ulkomaiset/singlet",
"url_title": "Myydyimmät ulkomaiset singlet vuonna {year}",
"lang": "(in Finnish)"
}
],
"combine": true,
"ref": "Musiikkituottajat – IFPI Finland."
}
}
Output reference will contain:
The first is domestic singles, the second is foreign: * "[url1 title1]" (in Finnish). Musiikkituottajat – IFPI Finland. Retrieved January 1, 2025. * "[url2 title2]" (in Finnish). Musiikkituottajat – IFPI Finland. Retrieved January 1, 2025.
Helper functions
editHelpers are special Lua functions for dynamic URL generation. They're defined in the module and referenced by name in JSON.
Conditional categories
editThe category_conditions field allows adding categories based on parameter values. Unlike number_one_category (which only checks position=1), this supports complex conditions.
{
"UKsinglesdownloads": {
"chart": "UK [[UK Singles Downloads Chart|Singles Downloads]]",
"provider": "[[Official Charts Company|OCC]]",
"category_conditions": [
{"when": "position=1", "category": "UK Singles Downloads Chart number-one singles"}
],
"url": "...",
"ref": "..."
}
}
Multiple conditions can be specified — all matching conditions add their categories:
"category_conditions": [
{"when": "position=1", "category": "Number-one singles"},
{"when": "position<=10", "category": "Top 10 singles"},
{"when": "year>=2020", "category": "2020s chart entries"}
]
The position parameter is available in conditions even though it's not a template parameter — it's extracted from the second positional argument.
Available helpers
edit| Helper | Charts | Required params | Description |
|---|---|---|---|
south_africa_size | single: Southafrica2 | year, week | Returns chart size (10/20/50/100) based on year and week. Chart size changed multiple times: 2021-2022 → 100, 2023 w18+ → 10, 2025 w13+ → 50, etc. |
australia_issue | single: Australiadance, Australiapandora, Australiaurban | url | Extracts issue number from pandora.nla.gov.au URL. Matches patterns like "Issue+123" or "issue%20456". |
bulgaria_date_range | single: Bulgaria | url | Extracts and formats date range from bamp-bg.org URL. Converts "01012024-07012024.html" to "01.01.2024 – 07.01.2024". |
czech_week_id | single: Czech Republic, Czechdigital, Slovakia, Slovakdigital; album: Czech, Slovakia | year, week | Returns weekId for ifpicr.cz URL. Looks up ID from Module:Music chart/chartdata-czech.json; for future weeks beyond table, calculates based on newest entry. Weeks 51+52 share same ID. |
germany_timestamp | album: GermanyComp | date | Converts DD.MM.YYYY to Unix timestamp in milliseconds for URL construction. |
Using helpers in JSON
edit{
"Southafrica2": {
"chart": "South Africa",
"provider": "[[The Official South African Charts|TOSAC]]",
"helper": "south_africa_size",
"url": "https://theofficialsacharts.co.za/chart/{year}/{week}/top-{helper}",
"url_title": "Top {helper} – Week {week}, {year}",
"ref": "[[The Official South African Charts]]."
}
}
The {helper} placeholder is replaced with the helper function's return value.
Adding new helpers
edit1. Add function in module:
function Helpers.your_helper_name(args)
local year = tonumber(args.year) or 0
-- your logic here
return "result"
end
2. Register required parameters:
Helpers.params = {
your_helper_name = {"year", "week"}, -- params won't be flagged as "unused"
-- ...
}
3. Use in JSON:
{
"helper": "your_helper_name",
"url": "https://example.com/{helper}"
}
Adding new charts
editStep 1: Edit JSON page. Open the appropriate JSON page and add entry under country group:
"NewCountry": {
"NewCountry": {
"chart": "New Country Singles",
"provider": "[[New Chart Provider]]",
"url": "https://example.com/chart?artist={artist}&song={song}",
"url_title": "{artist} – {song}",
"ref": "New Chart Provider."
}
}
Step 2: Verify. Use showCharts to verify:
{{#invoke:Music chart|showCharts|type=single|country=NewCountry}}
Check that:
- Required params are correctly detected
- Sample output looks correct
- No errors in output
Step 3: Add testcases. Add cases to the both proper parameters section and errors section.
Common patterns
editSimple chart (artist + song):
"SimpleChart": {
"chart": "Simple Chart",
"provider": "[[Provider]]",
"url": "https://example.com/{artist}/{song}",
"url_title": "{artist} – {song}",
"ref": "Provider Name."
}
Chart with date:
"DateChart": {
"chart": "Date Chart",
"provider": "[[Provider]]",
"date_format": "YYYY-MM-DD",
"url": "https://example.com/chart/{date}",
"url_title": "Chart for {dateMDY}",
"ref": "Provider Name."
}
Chart with year/week:
"WeekChart": {
"chart": "Week Chart",
"provider": "[[Provider]]",
"url": "https://example.com/{year}/week-{week}",
"url_title": "Week {week}, {year}",
"ref": "Provider Name."
}
Chart requiring user URL:
"ManualUrlChart": {
"chart": "Manual URL Chart",
"provider": "[[Provider]]",
"url_validation": "example.com",
"url": "{url}",
"url_title": "Chart Page",
"ref": "Provider Name."
}
Defunct chart:
"OldChart": {
"chart": "Old Chart",
"provider": "[[Provider]]",
"defunct": true,
"ref": "Provider Name (defunct)."
}
Module configuration
editThe CONFIG table at the top of the module contains all settings.
Text output
editmonths— month names array for{dateMDY}placeholdertype_names— display names for chart typeserrors— error message templateswarnings— warning templates shown in preview modetext— reference text templatescategories— tracking category templates
Position validation
editmax_position— maximum allowed numeric position (default: 200)accepted_dashes— array of accepted dash characters for "not charted" position; en-dash (–) for enwiki, em-dash (—) for ruwiki, hyphen (-) as fallback. Example:{"–", "—", "-"}
Core settings
editdefault_type— default chart type when not specifiedjson_path— path template to JSON data files,%sreplaced with typecategory_prefix— namespace prefix for categoriesdate_format_mdy— format string for{dateMDY}placeholder (%M= month name,%d= day,%Y= year)ref_prefixes— prefixes for auto-generated refnames by typeerror_display— where errors appear:"both"(cell and ref),"cell"only, or"ref"onlycheck_unknown_params— enable/disable tracking of unknown parameters (default:true)check_unused_params— enable/disable tracking of unused parameters (default:true)date_wrapper— optional template to reformat dates in references; set tonilto output as-is, or use parser function like{{#iferror:{{#time:j F Y|%s}}|%s}}to convert "2025-01-15" → "15 January 2025"date_patterns— Lua patterns for validating date formatsparam_aliases— alternative parameter names that map to canonical namesparams— parameter validation groups:base— always allowedcontent— chart-specificmanual— only with |3=M mode- Unknown parameters trigger tracking category; add new valid params here to suppress warnings
showCharts settings
editsort_order— sort order for groups and chart IDs:"abc"(alphabetical) or"keep"(preserve JSON order)group_wrapper— optional template for country/group names, e.g.{{Country|%s}}; to exclude specific groups from wrapping, add[no wrap]to the group name in JSON
Reference prefixes
editref_prefixes maps chart types to their reference name prefixes:
single→"sc"(produces refs likesc_Australia_Beyoncé)album→"ac"(produces refs likeac_Billboard200_Taylor Swift)year-end-singleandyear-end-album→"ye"(produces refs likeye_US_2024)
Reference naming
editDefault reference name format: {prefix}_{chartkey}_{suffix}
- Prefix: from
ref_prefixes(sc, ac, ye) - Suffix:
artistfor weekly charts,yearfor year-end charts
Examples:
sc_Australia_Beyoncéac_Billboard200_Taylor Swiftye_US_2024
Custom format via refname_format in JSON:
"refname_format": "sc_Oricon2_{songid}"
"refname_format": "sc_Finland_{artist}_{song|Airplay}"
The {param|default} syntax provides fallback if param is empty.
Entry points
editmain
editPrimary function called by templates. Processes all arguments and generates table row output.
{{#invoke:Music chart|main|type=single}}
chartExists
editUtility function to check if a chart key exists in the JSON data.
{{#invoke:Music chart|chartExists|chart=Australia|type=single}}
Returns 1 if chart exists, 0 otherwise. Useful for conditional logic in templates.
showCharts
editGenerates a table showing all charts from JSON with sample outputs.
{{#invoke:Music chart|showCharts|type=single}}
Output columns:
| Column | Parameter (default) | Description |
|---|---|---|
| — | type (single) | Chart type: single, album, year-end-single, year-end-album |
| Group | country (all) | Filters to one country/region group |
| Chart ID | — | Chart key. Aliases in yellow, defunct in red, multiple entries show condition. |
| Uses | uses (yes) | Page count using this chart (links to category) |
| Chart | — | Display name of the chart |
| Provider | — | Chart provider name |
| Required params | params (yes) | Parameters needed, date format in brackets |
| #1 Category | number1 (no) | Category when position=1 |
| Template call | template (no) | Copy-paste template call with detected parameters |
| Sample ref output | ref (yes) | Generated reference with sample values |
| Note | notes (no) | Shows doc_note from JSON. Consecutive identical notes are merged with rowspan. |
| — | splitdvd (no) | When yes, charts ending with "MV" (Music DVD) are output in a separate table below the main table. |
Example with all parameters:
{{#invoke:Music chart|showCharts|type=single|country=Australia|uses=yes|params=yes|number1=yes|template=1|ref=yes|notes=yes|splitdvd=yes}}
Notes column: When notes=yes, displays doc_note field from JSON for each chart. For charts with multiple entries, each entry can have its own doc_note that overrides the chart-level note. Consecutive rows with identical notes are automatically merged using rowspan.
Output includes links to JSON data page and template testcases page.
Error handling
editValidation checks
editThe module performs these validations:
- Missing chart key — Error if first parameter is empty
- Missing position — Error if second parameter is empty
- Unknown chart — Error if chart key not found in JSON
- Invalid position — Error if position is not a number 1–200 or accepted dash
- Missing required parameters — Error if placeholders in URL/title can't be filled
- Invalid date format — Error if date doesn't match expected format (when
date_formatspecified) - Invalid year format — Error if year is not exactly 4 digits
- Invalid week format — Error if week is not 1–2 digits (or combined like "51+52")
- Manual mode missing URL/title — Error if
3=Mis used without bothurlandtitle - URL validation — Error if user URL doesn't contain required substring (when
url_validationspecified) - Unsubstituted placeholders — Error if output still contains
{placeholder}patterns
Error display
editErrors appear as red text. The error_display config controls where:
"both"— Show in both table cell and reference"cell"— Show only in table cell"ref"— Show only in reference
Warnings (preview only)
editSome issues show orange warnings only in preview mode (not on saved pages):
| Warning | When shown |
|---|---|
| Unknown parameters | Parameters provided but not recognized by the module |
| Unused parameters | Parameters provided but not used by chart |
| Invalid date (ref only) | Date format invalid, but date only used in reference text (not URL) |
| Invalid year/week (ref only) | Year/week format invalid, but only used in reference text (not URL) |
Detection uses {{REVISIONID}} — empty in preview, has value on saved pages.
If date is used in URL, invalid format shows as red error on all pages.
Tracking categories
editCategories are added for various conditions:
| Category pattern | When added |
|---|---|
{Type} chart usages for {ChartKey} | Always (for usage tracking) |
{Type} chart used with missing parameters | Required params missing |
{Type} chart used with unknown chart | Chart key not found |
{Type} chart with invalid position | Position is not a valid number (1–200) or accepted dash |
Pages using {type} chart with unknown parameters | Unknown params provided |
{Type} chart with unused parameters | Params provided but not used |
{Type} chart with unsubstituted parameters | Raw {{{param}}} or {placeholder} remains in output |
{Type} chart called without artist | Artist param missing |
{Type} chart called without song | Song param missing (single charts) |
{Type} chart called without album | Album or dvd param missing (album charts) |
{Type} chart used with defunct chart | Chart marked as defunct |
{Type} chart making named ref | Custom refname provided |
{Type} chart using manual ref mode | Manual mode (3=M) used |
{Type} chart with manual mode missing url or title | Manual mode used without url or title |
{Type} chart {ChartKey} without {Param} parameter | Chart-specific tracked parameter missing |
Categories are only added in main namespace (ns=0, articles). They are suppressed in all other namespaces including Template, User, and Talk pages.