Jump to content

Template:Resource: Difference between revisions

From WYOS Wiki
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 2: Line 2:
<!--
<!--
   ==================================================================
   ==================================================================
   == VISIBLE INFOBOX - Conditional display for wiki/admin views.
   == VISIBLE INFOBOX - For display on the wiki page only.
   ==================================================================
   ==================================================================
-->
-->
Line 20: Line 20:
{{!}}-
{{!}}-
! Type
! Type
{{!}} {{{Resource Type}}}
{{!}} [[{{{Resource Type}}}]]
}}
}}
{{#if:{{{Author|}}}|
{{#if:{{{Author|}}}|
Line 33: Line 33:
}}
}}
{{#if:{{{Topic Tags|}}}|
{{#if:{{{Topic Tags|}}}|
{{!}}-
{{!}}-
! Topics
! Topics
{{!}} {{{Topic Tags}}}
{{!}} {{#arraymap:{{{Topic Tags}}}|,|x|[[x|{{#replace:x|Tag:|}}]]|,&#32;}}
}}
}}
{{#if:{{{Status|}}}|
{{#if:{{{Status|}}}|
{{!}}-
{{!}}-
Line 50: Line 51:
{{!}}-
{{!}}-
! Owner
! Owner
{{!}} [[User:{{{Owner}}}|{{{Owner}}}]]
{{!}} [[{{#ifeq:{{lc:{{#titleparts:{{{Owner}}}|1|1}}}}|user|{{{Owner}}}|User:{{{Owner}}}}}|{{#replace:{{{Owner}}}|User:|}}]]
}}
}}
{{#if:{{{Description|}}}|
{{#if:{{{Description|}}}|
Line 58: Line 59:
}}
}}
|}
|}
<!--
<!--
   ==================================================================
   ==================================================================
   == HIDDEN SEMANTIC DATA - Single source for API queries.
   == HIDDEN SEMANTIC DATA - The single source of truth for your headless CMS.
   ==================================================================
   ==================================================================
-->
-->
<div style="display:none;">
<div style="display:none;">
[[Category:Resources]]
[[Category:Resources]]
 
<!-- Set controlled vocabulary properties. Default status is 'Draft'. -->
<!-- RECOMMENDED: Do NOT set Belongs to platform section here (Topic Cards decide hub placement). -->
<!-- ALTERNATIVE (if needed): [[Belongs to platform section::Resources]] -->
 
<!-- Controlled vocab / state (Text types; enforce via forms) -->
[[Has status::{{{Status|Draft}}}]]
[[Has status::{{{Status|Draft}}}]]
{{#if:{{{Resource Type|}}}|[[Has resource type::{{{Resource Type}}}]]}}
{{#if:{{{Resource Type|}}}
 
| [[Has resource type::{{{Resource Type}}}]]
<!-- Standard props (Text/Page/URL) -->
}}
{{#if:{{{Display Title|}}}|[[Has display title::{{{Display Title}}}]]}}
<!-- Set standard properties only if a value is provided. -->
{{#if:{{{Subtitle|}}}|[[Has subtitle::{{{Subtitle}}}]]}}
{{#if:{{{Display Title|}}}
{{#if:{{{Description|}}}|[[Has description::{{{Description}}}]]}}
| [[Has display title::{{{Display Title}}}]]
{{#if:{{{URL|}}}|[[Has url::{{{URL}}}]]}}
}}
{{#if:{{{Author|}}}|[[Has author::{{{Author}}}]]}}
{{#if:{{{Subtitle|}}}
{{#if:{{{Owner|}}}|[[Has owner::User:{{{Owner}}}]]}}
| [[Has subtitle::{{{Subtitle}}}]]
 
}}
<!-- Robust image (File type) -->
{{#if:{{{Description|}}}
{{#if:{{{Image|}}}|[[Has image::{{#ifeq:{{lc:{{#titleparts:{{{Image}}}|1|1}}}}|file|{{{Image}}}|File:{{{Image}}}}}]]}}
| [[Has description::{{{Description}}}]]
 
}}
<!-- Boolean (true/false for queries) -->
{{#if:{{{URL|}}}
| [[Has url::{{{URL}}}]]
}}
{{#if:{{{Author|}}}
| [[Has author::{{{Author}}}]]
}}
<!-- 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}}}}}]]
}}
<!-- 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}}}}}]]
}}
<!-- 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}}]]
 
{{#if:{{{Topic Tags|}}}
<!-- Multi-value tags (Page type; trims spaces, comma-separated Tag: pages) -->
| {{#arraymap:{{{Topic Tags}}}|,|x|[[Has topic tag::x]]|\s}}
{{#if:{{{Topic Tags|}}}|{{#arraymap:{{{Topic Tags|}}}|,|x|[[Has topic tag::{{#trim:x}}]]}}}
}}
</div>
</div>
<!--
<!--
   ==================================================================
   ==================================================================
   == CONTENT - Populated by type-specific wrappers (e.g., Template:Book).
   == CONTENT - This displays the main body of the article.
   ==================================================================
   ==================================================================
-->
-->
Line 100: Line 109:
</includeonly><noinclude>
</includeonly><noinclude>
'''Template:Resource'''
'''Template:Resource'''
 
Master template for Resource entries. Call via type wrappers only (e.g., <nowiki>{{Book|…}}</nowiki>). Handles infobox and shared semantics for headless API pulls.
Master template for Resource entries—call via type wrappers only (e.g., {{Book}}). Handles infobox and shared semantics for headless API pulls.
<templatedata>
 
{
=== Parameters ===
"params": {
* '''Display Title''': Required; user-facing title (Text).
"Image": {
* '''Subtitle''': Optional; tagline (Text).
"label": "Image",
* '''Description''': Optional; card teaser (Text).
"description": "Filename of the image for the infobox (e.g., \"Tool_Logo.png\").",
* '''Image''': Optional; filename, auto-prefixes File: (File).
"type": "wiki-file-name"
* '''Resource Type''': Auto-passed by wrapper (Page; controlled: Apps|Books|etc.).
},
* '''Topic Tags''': Required; comma-separated Tag: pages (e.g., Tag:Productivity,Tag:Habits) for multi-value filtering (Page).
"Display Title": {
* '''Status''': Publication state; defaults Draft (Text; controlled: Draft|Published|Archived).
"label": "Display Title",
* '''Is Featured''': yes/no flag; defaults no (Boolean).
"description": "Primary, user-facing title of the resource.",
* '''Owner''': Required; username for accountability (Text; stores as User: page).
"type": "line"
* '''URL''': Optional; external link (URL).
},
* '''Author''': Optional; creator/author (Text).
"Subtitle": {
* '''Content''': Auto-passed; main body wikitext (e.g., why this resource works).
"label": "Subtitle",
 
"description": "Short descriptive tagline.",
=== Validation ===
"type": "line"
- **Syntax Check**: Braces balanced; Owner as User: for namespace queries.
},
- **Test Query**: `{{#ask: [[Category:Resources]] [[Has resource type::[[Books]]]] [[Has owner::User:TestUser]] |?Has display title |format=plainlist }}`—lists owned Books.
"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>
</noinclude>

Latest revision as of 19:46, 23 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).

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
ImageImage

Filename of the image for the infobox (e.g., "Tool_Logo.png").

Fileoptional
Display TitleDisplay Title

Primary, user-facing title of the resource.

Lineoptional
SubtitleSubtitle

Short descriptive tagline.

Lineoptional
Resource TypeResource Type

Type of resource (e.g., Book, App, Course). Set by wrapper templates.

Page nameoptional
Author/CreatorAuthor

Creator, publisher, or vendor as appropriate.

Lineoptional
URLURL

Primary external link (homepage, store page, etc.).

URLoptional
Topic TagsTopic Tags

Comma-separated Topic Tags. Enter either "Tag:Habits, Tag:Productivity" or "Habits, Productivity".

Linerequired
StatusStatus

Publication status. Only Published should surface on the front end.

Suggested values
Draft Published Archived
Default
Draft
Linerequired
Featured?Is Featured

Set to 'yes' to highlight this item.

Booleanoptional
OwnerOwner

Responsible username (no "User:" prefix).

Userrequired
DescriptionDescription

Short 1–2 sentence summary shown on cards and lists.

Stringrequired
Main ContentContent

Body content; wikitext/VisualEditor supported.

Contentsuggested