Template:Resource: Difference between revisions
No edit summary |
No edit summary |
||
| Line 35: | Line 35: | ||
{{!}}- | {{!}}- | ||
! Topics | ! Topics | ||
{{!}} {{{Topic Tags}}} | {{!}} {{#arraymap:{{{Topic Tags|}}}|,|t| | ||
{{#ifeq:{{lc:{{#titleparts:{{#trim:t}}|1|1}}}}|tag | |||
| [[{{#trim:t}}|{{#replace:{{#trim:t}}|Tag:|}}]] | |||
| [[Tag:{{#trim:t}}|{{#trim:t}}]] | |||
}} | |||
|, }} | |||
}} | }} | ||
{{#if:{{{Status|}}}| | {{#if:{{{Status|}}}| | ||
| Line 69: | Line 74: | ||
<!-- Set controlled vocabulary properties. Default status is 'Draft'. --> | <!-- Set controlled vocabulary properties. Default status is 'Draft'. --> | ||
[[Has status::{{{Status|Draft}}}]] | [[Has status::{{{Status|Draft}}}]] | ||
{{#if:{{{Resource Type|}}}|[[Has resource type::{{{Resource Type}}}]]}} | {{#if:{{{Resource Type|}}} | ||
| [[Has resource type::{{{Resource Type}}}]] | |||
}} | |||
<!-- Set standard properties only if a value is provided. --> | <!-- Set standard properties only if a value is provided. --> | ||
{{#if:{{{Display Title|}}}|[[Has display title::{{{Display Title}}}]]}} | {{#if:{{{Display Title|}}} | ||
{{#if:{{{Subtitle|}}}|[[Has subtitle::{{{Subtitle}}}]]}} | | [[Has display title::{{{Display Title}}}]] | ||
{{#if:{{{Description|}}}|[[Has description::{{{Description}}}]]}} | }} | ||
{{#if:{{{URL|}}}|[[Has url::{{{URL}}}]]}} | {{#if:{{{Subtitle|}}} | ||
{{#if:{{{Author|}}}|[[Has author::{{{Author}}}]]}} | | [[Has subtitle::{{{Subtitle}}}]] | ||
}} | |||
{{#if:{{{Description|}}} | |||
| [[Has description::{{{Description}}}]] | |||
}} | |||
{{#if:{{{URL|}}} | |||
| [[Has url::{{{URL}}}]] | |||
}} | |||
{{#if:{{{Author|}}} | |||
| [[Has author::{{{Author}}}]] | |||
}} | |||
<!-- Robust Owner Handling: Adds 'User:' prefix only if it's missing. --> | <!-- Robust Owner Handling: Adds 'User:' prefix only if it's missing. --> | ||
{{#if:{{{Owner|}}}|[[Has owner::{{#ifeq:{{lc:{{#titleparts:{{{Owner}}}|1|1}}}}|user|{{{Owner}}}|User:{{{Owner | {{#if:{{{Owner|}}} | ||
| [[Has owner::{{#ifeq:{{lc:{{#titleparts:{{{Owner}}}|1|1}}}}|user|{{{Owner}}}|User:{{{Owner}}}}}]] | |||
}} | |||
<!-- Robust image handling: adds 'File:' prefix only if user forgets it. --> | <!-- Robust image handling: adds 'File:' prefix only if user forgets it. --> | ||
{{#if:{{{Image|}}}|[[Has image::{{#ifeq:{{lc:{{#titleparts:{{{Image}}}|1|1}}}}|file|{{{Image}}}|File:{{{Image | {{#if:{{{Image|}}} | ||
| [[Has image::{{#ifeq:{{lc:{{#titleparts:{{{Image}}}|1|1}}}}|file|{{{Image}}}|File:{{{Image}}}}}]] | |||
}} | |||
<!-- Set boolean property to return true/false for the API. --> | <!-- Set boolean property to return true/false for the API. --> | ||
[[Is featured::{{#ifeq:{{lc:{{{Is Featured|no}}}}}|yes|true|false}}]] | [[Is featured::{{#ifeq:{{lc:{{{Is Featured|no}}}}}|yes|true|false}}]] | ||
<!-- | <!-- Normalize Topic Tags to Tag: namespace and set multi-value Page property --> | ||
{{#if:{{{Topic Tags|}}}|{{#arraymap:{{{Topic Tags|}}}|,| | {{#if:{{{Topic Tags|}}} | ||
| {{#arraymap:{{{Topic Tags|}}}|,|t| | |||
[[Has topic tag::{{#ifeq:{{lc:{{#titleparts:{{#trim:t}}|1|1}}}}|tag | |||
| {{#trim:t}} | |||
| Tag:{{#trim:t}} | |||
}}]] | |||
}} | |||
}} | |||
</div> | </div> | ||
| Line 101: | Line 129: | ||
'''Template:Resource''' | '''Template:Resource''' | ||
Master template for Resource entries. Call via type wrappers only (e.g., {{Book}}). Handles infobox and shared semantics for headless API pulls. | Master template for Resource entries. Call via type wrappers only (e.g., <nowiki>{{Book|…}}</nowiki>). Handles infobox and shared semantics for headless API pulls. | ||
</noinclude> | <templatedata> | ||
{ | |||
"params": { | |||
"Image": { | |||
"label": "Image", | |||
"description": "Filename of the image for the infobox (e.g., \"Tool_Logo.png\").", | |||
"type": "wiki-file-name" | |||
}, | |||
"Display Title": { | |||
"label": "Display Title", | |||
"description": "Primary, user-facing title of the resource.", | |||
"type": "line" | |||
}, | |||
"Subtitle": { | |||
"label": "Subtitle", | |||
"description": "Short descriptive tagline.", | |||
"type": "line" | |||
}, | |||
"Resource Type": { | |||
"label": "Resource Type", | |||
"description": "Type of resource (e.g., Book, App, Course). Set by wrapper templates.", | |||
"type": "wiki-page-name" | |||
}, | |||
"Author": { | |||
"label": "Author/Creator", | |||
"description": "Creator, publisher, or vendor as appropriate.", | |||
"type": "line" | |||
}, | |||
"URL": { | |||
"label": "URL", | |||
"description": "Primary external link (homepage, store page, etc.).", | |||
"type": "url" | |||
}, | |||
"Topic Tags": { | |||
"label": "Topic Tags", | |||
"description": "Comma-separated Topic Tags. Enter either \"Tag:Habits, Tag:Productivity\" or \"Habits, Productivity\".", | |||
"type": "line", | |||
"required": true | |||
}, | |||
"Status": { | |||
"label": "Status", | |||
"description": "Publication status. Only Published should surface on the front end.", | |||
"type": "line", | |||
"suggestedvalues": ["Draft","Published","Archived"], | |||
"default": "Draft", | |||
"required": true | |||
}, | |||
"Is Featured": { | |||
"label": "Featured?", | |||
"description": "Set to 'yes' to highlight this item.", | |||
"type": "boolean" | |||
}, | |||
"Owner": { | |||
"label": "Owner", | |||
"description": "Responsible username (no \"User:\" prefix).", | |||
"type": "wiki-user-name", | |||
"required": true | |||
}, | |||
"Description": { | |||
"label": "Description", | |||
"description": "Short 1–2 sentence summary shown on cards and lists.", | |||
"type": "string", | |||
"required": true | |||
}, | |||
"Content": { | |||
"label": "Main Content", | |||
"description": "Body content; wikitext/VisualEditor supported.", | |||
"type": "content", | |||
"suggested": true | |||
} | |||
}, | |||
"description": "Master template for all Resource entries. Use via type-specific wrappers (e.g., Book, App).", | |||
"format": "block" | |||
} | |||
</templatedata></noinclude> | |||
Revision as of 17:59, 21 September 2025
Template:Resource
Master template for Resource entries. Call via type wrappers only (e.g., {{Book|…}}). Handles infobox and shared semantics for headless API pulls.
Master template for all Resource entries. Use via type-specific wrappers (e.g., Book, App).
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Image | Image | Filename of the image for the infobox (e.g., "Tool_Logo.png"). | File | optional |
| Display Title | Display Title | Primary, user-facing title of the resource. | Line | optional |
| Subtitle | Subtitle | Short descriptive tagline. | Line | optional |
| Resource Type | Resource Type | Type of resource (e.g., Book, App, Course). Set by wrapper templates. | Page name | optional |
| Author/Creator | Author | Creator, publisher, or vendor as appropriate. | Line | optional |
| URL | URL | Primary external link (homepage, store page, etc.). | URL | optional |
| Topic Tags | Topic Tags | Comma-separated Topic Tags. Enter either "Tag:Habits, Tag:Productivity" or "Habits, Productivity". | Line | required |
| Status | Status | Publication status. Only Published should surface on the front end.
| Line | required |
| Featured? | Is Featured | Set to 'yes' to highlight this item. | Boolean | optional |
| Owner | Owner | Responsible username (no "User:" prefix). | User | required |
| Description | Description | Short 1–2 sentence summary shown on cards and lists. | String | required |
| Main Content | Content | Body content; wikitext/VisualEditor supported. | Content | suggested |