Jump to content

Template:Resource: Difference between revisions

From WYOS Wiki
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
<includeonly>
<!--  
<!--
   ==================================================================
   ==================================================================
   == VISIBLE INFOBOX - This section only displays data.
   == VISIBLE INFOBOX - For display on the wiki page only.
  == It does not assign any semantic properties.
   ==================================================================
   ==================================================================
-->
-->
{| class="wikitable wyos-infobox" style="float:right; margin-left:1em; width:300px;"
{| class="wikitable wyos-infobox" style="float:right; margin-left:1em; width:300px;"
| colspan="2" style="text-align:center;" | {{#if:{{{Image|}}}|[[File:{{{Image}}}|290px]]|''No image provided''}}
| colspan="2" style="text-align:center;" | {{#if:{{{Image|}}}|[[File:{{{Image}}}|290px]]|''No image provided''}}
{{#if:{{{Display Title|}}}|{{!}}-
{{#if:{{{Display Title|}}}|
{{!}}-
! Display Title
! Display Title
{{!}} {{{Display Title}}}
{{!}} {{{Display Title}}}
}}
}}
{{#if:{{{Subtitle|}}}|{{!}}-
{{#if:{{{Subtitle|}}}|
{{!}}-
! Subtitle
! Subtitle
{{!}} {{{Subtitle}}}
{{!}} {{{Subtitle}}}
}}
}}
{{#if:{{{Resource Type|}}}|{{!}}-
{{#if:{{{Resource Type|}}}|
{{!}}-
! Type
! Type
{{!}} {{{Resource Type}}}
{{!}} [[{{{Resource Type}}}]]
}}
}}
{{#if:{{{Author|}}}|{{!}}-
{{#if:{{{Author|}}}|
{{!}}-
! Author/Creator
! Author/Creator
{{!}} {{{Author}}}
{{!}} {{{Author}}}
}}
}}
{{#if:{{{URL|}}}|{{!}}-
{{#if:{{{URL|}}}|
{{!}}-
! URL
! URL
{{!}} [{{{URL}}} Visit Site]
{{!}} [{{{URL}}} Visit Site]
}}
}}
{{#if:{{{Topic Tags|}}}|{{!}}-
{{#if:{{{Topic Tags|}}}|
! Topics
{{!}}-
{{!}} {{{Topic Tags}}}
! Topics
{{!}} {{#arraymap:{{{Topic Tags}}}|,|x|[[x|{{#replace:x|Tag:|}}]]|,&#32;}}
}}
}}
{{#if:{{{Status|}}}|{{!}}-
 
{{#if:{{{Status|}}}|
{{!}}-
! Status
! Status
{{!}} {{{Status}}}
{{!}} {{{Status}}}
}}
}}
{{#if:{{{Is Featured|}}}|{{!}}-
{{#if:{{{Is Featured|}}}|
{{!}}-
! Featured
! Featured
{{!}} {{{Is Featured}}}
{{!}} {{#ifeq:{{lc:{{{Is Featured|no}}}}}|yes|Yes|No}}
}}
}}
{{#if:{{{Description|}}}|{{!}}-
{{#if:{{{Owner|}}}|
{{!}}-
! Owner
{{!}} [[{{#ifeq:{{lc:{{#titleparts:{{{Owner}}}|1|1}}}}|user|{{{Owner}}}|User:{{{Owner}}}}}|{{#replace:{{{Owner}}}|User:|}}]]
}}
{{#if:{{{Description|}}}|
{{!}}-
! Description
! Description
{{!}} {{{Description}}}
{{!}} {{{Description}}}
}}
}}
|}
|}
 
<!--
<!--  
   ==================================================================
   ==================================================================
   == HIDDEN SEMANTIC DATA - This is the single source of truth for  
   == HIDDEN SEMANTIC DATA - The single source of truth for your headless CMS.
  == assigning all semantic properties for the entry.
   ==================================================================
   ==================================================================
-->
-->
<div style="display:none;">
<div style="display:none;">
[[Category:Resources]]
[[Category:Resources]]
[[Belongs to section::Resources]]
<!-- Set controlled vocabulary properties. Default status is 'Draft'. -->
 
[[Has status::{{{Status|Draft}}}]]
<!-- Set controlled vocabulary properties -->
{{#if:{{{Resource Type|}}}
[[Has status::{{{Status|Published}}}]]
| [[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|}}}
{{#if:{{{Display Title|}}}|[[Has display title::{{{Display Title}}}]]}}
| [[Has display title::{{{Display Title}}}]]
{{#if:{{{Subtitle|}}}|[[Has subtitle::{{{Subtitle}}}]]}}
}}
{{#if:{{{Image|}}}|[[Has image::{{{Image}}}]]}}
{{#if:{{{Subtitle|}}}
{{#if:{{{Description|}}}|[[Has description::{{{Description}}}]]}}
| [[Has subtitle::{{{Subtitle}}}]]
{{#if:{{{URL|}}}|[[Has url::{{{URL}}}]]}}
}}
{{#if:{{{Author|}}}|[[Has author::{{{Author}}}]]}}
{{#if:{{{Description|}}}
 
| [[Has description::{{{Description}}}]]
<!-- Set boolean property -->
}}
[[Is featured::{{#ifeq:{{lc:{{{Is Featured|no}}}}}|yes|yes|no}}]]
{{#if:{{{URL|}}}
 
| [[Has url::{{{URL}}}]]
<!-- Set multi-value 'Page' property -->
}}
{{#arraymap:{{{Topic Tags|}}}|,|x|[[Has topic tag::x]]}}
{{#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}}]]
{{#if:{{{Topic Tags|}}}
| {{#arraymap:{{{Topic Tags}}}|,|x|[[Has topic tag::x]]|\s}}
}}
</div>
</div>
 
<!--
<!--  
   ==================================================================
   ==================================================================
   == CONTENT SECTION - Populated by resource type-specific templates.
   == CONTENT - This displays the main body of the article.
   ==================================================================
   ==================================================================
-->
-->
{{{Content|}}}
{{{Content|}}}
</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.
This is the MASTER template for all Resource section entries. It should NOT be called directly.
<templatedata>
This template handles the infobox display and assigns all shared semantic properties.
{
 
"params": {
Use a type-specific wrapper template (e.g., Template:Book, Template:App), which will call this one and provide the necessary data.
"Image": {
 
"label": "Image",
=== Parameters ===
"description": "Filename of the image for the infobox (e.g., \"Tool_Logo.png\").",
* '''Image''': The filename of the main image (e.g., "My_Awesome_Image.jpg").
"type": "wiki-file-name"
* '''Display Title''': The primary title shown to users.
},
* '''Subtitle''': The secondary title or tagline.
"Display Title": {
* '''Resource Type''': The type of the resource (e.g., [[Book]]). Must be a link to the type page.
"label": "Display Title",
* '''Author''': The author or creator of the resource (e.g., for books, courses).
"description": "Primary, user-facing title of the resource.",
* '''URL''': The primary external link for the resource.
"type": "line"
* '''Topic Tags''': A comma-separated list of links to topic pages (e.g., [[Habits]], [[Deep Work]]). This is critical for discovery.
},
* '''Status''': The publication status (Published, Draft, Archived). Defaults to "Published".
"Subtitle": {
* '''Is Featured''': A "yes" or "no" flag to feature the content. Defaults to "no".
"label": "Subtitle",
* '''Description''': The short summary used on content cards.
"description": "Short descriptive tagline.",
* '''Content''': This parameter is reserved for the main body of the resource description, passed in from a type-specific template.
"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>
</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