Jump to content

Template:Resource query

From HopperWiki

A general-purpose template for querying the Resource Cargo table. Works out of the box on any page — by default it filters resources by the current page title using the geography field. All columns and filter behavior are configurable via parameters.

This template applies the following filters: All_geography HOLDS {{PAGENAME}}



What this template shows

Field Displayed as
Name
Year published
Link

Parameters

All parameters are optional unless noted.

Parameter Default Purpose
filter_value Current page title Override the value used to filter
row_cutoff 3 Rows shown before the table collapses
character_cutoff 600 Characters per cell before truncation
format table table, bulleted_list, or count

Advanced usage

For complex queries—multiple filter fields, raw WHERE clauses, ORDER BY, GROUP BY, LIMIT—invoke Module:Cargo_query directly rather than through this template. See Module:Cargo_query for full parameter documentation.

Basic usage

On any geography or species page, just transclude with no parameters:

{{Resource query}}

This shows Name, Year, and Link for all resources tagged with the current page in All_geography.

Choosing columns

All columns are off by default except Name, Year, and Link. Turn extras on with yes:

Parameter Column shown Default Notes
show_name Name yes
show_year Year published yes
show_link Resource link yes
show_title Long title off
show_language Language off
show_category Category off
show_keywords Keywords off
show_author Author off
show_file File off
show_geography Geographic purview off
show_all_geography All geography off Internal field — includes parent geography entries
show_species Species purview off
show_description Description off
show_project Project off
show_copyright Copyright off
show_substance Substance off Internal classification field
show_substance_rating Substance rating off Internal classification field
show_otu_id OTU ID off Internal pipeline field

Example — show name, author, year, and language:

{{Resource query
| show_author   = yes
| show_language = yes
}}

Filtering

The filter parameter controls which field is used to match the current page. Defaults to geography.

filter value Filters on Use on
geography All_geography HOLDS Resource query Geography pages
species Species_purview HOLDS Resource query Species pages
category Category = {{{filter_value}}} Any page; requires filter_value
keyword Descriptive_keyword HOLDS {{{filter_value}}} Any page; requires filter_value
language Language HOLDS {{{filter_value}}} Any page; requires filter_value

Example — species page showing only identification resources:

{{Resource query
| filter        = species
| exclude       = Category = Media
| show_author   = yes
| show_keywords = yes
}}

Example — all resources tagged with a keyword, newest first:

{{Resource query
| filter        = keyword
| filter_value  = Identification
| exclude       = Language = French
| show_author   = yes
| show_language = yes
| limit         = 10
}}

Exclusions

Use exclude to drop rows matching a condition. Semicolon-separated for multiple conditions:

{{Resource query
| exclude = Category = Media; Language = French
}}

Sorting and limits

Parameter Default Notes
sort Year_published Any Cargo field name. Note: Year_published is a string field so ordering is lexicographic — store years as plain four-digit strings for correct results.
sort_order DESC ASC or DESC
limit none Hard cap on results returned from Cargo
row_cutoff 3 Rows visible before the table collapses
character_cutoff 600 Characters per cell before truncation
format table table, bulleted_list, or count

For developers

This template is a user-facing wrapper over p.resource_query in Module:Cargo_query. Column selection and WHERE clause construction happen entirely in Lua — do not attempt to replicate this logic in wikitext.

For queries this template cannot express — multiple focal fields, raw WHERE clauses, ORDER BY on computed fields — invoke p.query directly. See Module:Cargo_query for full parameter documentation.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.