Template:Related models
| Diecast Project code | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
| Templates | ||||||||||
| series list • series infobox • poster sort case • case header | ||||||||||
| Value indexes | ||||||||||
| ||||||||||
| Functions | ||||||||||
| Global: name escape • product no. • sortkey • numberSort Row output: m-series • m-segment • m-country • card checker • note checker* • edit shortcut Cases: printContent • storeContent Query tools: col - makeSeriesColumn • getCaseStats | ||||||||||
| Messages | ||||||||||
| Landing: top • bottom • year nav Search: results-header • results • button text | ||||||||||
| [src] |
SQL (Cargo)-based footer for Vehicle: pages. Absent a full-text search engine like Elastic, this is a (perhaps minimal) substitute for the functionality a related articles extension would provide. At the bottom of every page, three "more vehicles" are selected – based firstly on page-name keywords, then simply at random on fallback – and offered to the reader.
If desired, a second set of manual recommendations can be included by setting |related1=, |related2=, and |related3= in the {{vehicle infobox}} to the "related models" you wish to suggest. Just like in a case, make sure the input value exactly matches the Vehicle: page name (exempting ' single and " double quotes, which can be omitted.)
Algorithm
If you can really call it that, a simple {{#rreplace:}} splits each word in the page title, and feeds them each as {{#cargo_query:}} keyword strings. Fabulous Lightning McQueen becomes [vehicle] Name like '%Fabulous%' OR Name like '%Lightning%' OR Name like '%McQueen%'; a couple extra rules exclude any "related models" already set, alongside vehicles with no main photo. That's it.
In all seriousness, this feature is basically an afterthought, strewn together in reaction to (unforeseen) challenges holding back more powerful tools. We will hopefully flesh it out a bit more in the near future.
Parameters
All three |relatedN= names are set and passed down by variable from the vehicle infobox. This component template is transcluded as part of {{table end}}.
| Name | Type | Notes |
|---|---|---|
|related1= |
string | Corresponds to left recommendation box. Value received from {{#var:related1}}
|
|related2= |
string | Corresponds to middle recommendation box. Value received from {{#var:related2}}
|
|related3= |
string | Corresponds to right recommendation box. Value received from {{#var:related3}}
|
See also
- {{RelatedVehicles}} - Formatter for the
templatequery, i.e. where the actual element structure is. - Help:Vehicle - Rules for the "related models" settings.