Template:CategoryCard: Difference between revisions
Template page
More actions
No edit summary |
(No difference)
|
Revision as of 09:06, 16 March 2026

[[|Category]]
CategoryCard
Displays a visual card linking to a project category hub. Used on the Main Page to show all project categories with an icon, name, description, and live project count.
Usage
{{CategoryCard
| icon = mimetypes-audio-x-generic
| name = Audio
| link = Projects/Audio
| description = Music, sound design, field recordings, and anything audio.
| count = {{#cargo_query:tables=Projects|fields=COUNT(DISTINCT _pageID)=n|where=categories HOLDS 'Audio'}}
}}
Parameters
icon- Filename of the icon without the
.pngextension (e.g.mimetypes-audio-x-generic). Defaults toplaces-folder. name- Display name shown on the card. Defaults to "Category".
link- Wiki page to link to (e.g.
Projects/Audio). description- Optional short description shown below the name.
count- Optional project count shown at the bottom. Use a
#cargo_queryfor a live count — see usage example above.
Notes
- For live counts, use Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'HOLDS 'CategoryName' ORDER BY COUNT(DISTINCT _pageID) LIMIT 100' at line 1
Function: CargoSQLQuery::run
Query: SELECT COUNT(DISTINCT _pageID) AS `n` FROM `cargo__Projects` `Projects` WHERE categories HOLDS 'CategoryName' ORDER BY COUNT(DISTINCT _pageID) LIMIT 100
.
- Wrap multiple CategoryCards in
{{CardGrid}}.