Jump to content

Template:Resource: Difference between revisions

From WYOS Wiki
No edit summary
No edit summary
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 50: Line 50:
{{!}}-
{{!}}-
! Owner
! Owner
{{!}} [[User:{{{Owner}}}|{{{Owner}}}]]
{{!}} [[{{#ifeq:{{lc:{{#titleparts:{{{Owner}}}|1|1}}}}|user|{{{Owner}}}|User:{{{Owner}}}}}|{{#replace:{{{Owner}}}|User:|}}]]
}}
}}
{{#if:{{{Description|}}}|
{{#if:{{{Description|}}}|
Line 61: Line 61:
<!--
<!--
   ==================================================================
   ==================================================================
   == HIDDEN SEMANTIC DATA - Single source for API queries.
   == HIDDEN SEMANTIC DATA - The single source of truth for your headless CMS.
   ==================================================================
   ==================================================================
-->
-->
Line 67: Line 67:
[[Category:Resources]]
[[Category:Resources]]


<!-- RECOMMENDED: Do NOT set Belongs to platform section here (Topic Cards decide hub placement). -->
<!-- Set controlled vocabulary properties. Default status is 'Draft'. -->
<!-- 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) -->
<!-- Set standard properties only if a value is provided. -->
{{#if:{{{Display Title|}}}|[[Has display title::{{{Display Title}}}]]}}
{{#if:{{{Display Title|}}}|[[Has display title::{{{Display Title}}}]]}}
{{#if:{{{Subtitle|}}}|[[Has subtitle::{{{Subtitle}}}]]}}
{{#if:{{{Subtitle|}}}|[[Has subtitle::{{{Subtitle}}}]]}}
Line 80: Line 77:
{{#if:{{{URL|}}}|[[Has url::{{{URL}}}]]}}
{{#if:{{{URL|}}}|[[Has url::{{{URL}}}]]}}
{{#if:{{{Author|}}}|[[Has author::{{{Author}}}]]}}
{{#if:{{{Author|}}}|[[Has author::{{{Author}}}]]}}
{{#if:{{{Owner|}}}|[[Has owner::User:{{{Owner}}}]]}}


<!-- Robust image (File type) -->
<!-- Robust Owner Handling: Adds 'User:' prefix only if it's missing. -->
{{#if:{{{Image|}}}|[[Has image::{{#ifeq:{{lc:{{#titleparts:{{{Image}}}|1|1}}}}|file|{{{Image}}}|File:{{{Image}}}}}]]}}
{{#if:{{{Owner|}}}|[[Has owner::{{#ifeq:{{lc:{{#titleparts:{{{Owner}}}|1|1}}}}|user|{{{Owner}}}|User:{{{Owner}}}}}}]]}}


<!-- Boolean (true/false for queries) -->
<!-- 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}}]]


<!-- Multi-value tags (Page type; trims spaces, comma-separated Tag: pages) -->
<!-- Set multi-value 'Page' property. #trim prevents errors from extra spaces. -->
{{#if:{{{Topic Tags|}}}|{{#arraymap:{{{Topic Tags|}}}|,|x|[[Has topic tag::{{#trim:x}}]]}}}
{{#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.
   ==================================================================
   ==================================================================
-->
-->
{{{Content|}}}
{{{Content|}}}
</includeonly><noinclude>
</includeonly><noinclude>
'''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., {{Book}}). Handles infobox and shared semantics for headless API pulls.
 
=== Parameters ===
* '''Display Title''': Required; user-facing title (Text).
* '''Subtitle''': Optional; tagline (Text).
* '''Description''': Optional; card teaser (Text).
* '''Image''': Optional; filename, auto-prefixes File: (File).
* '''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).
* '''Status''': Publication state; defaults Draft (Text; controlled: Draft|Published|Archived).
* '''Is Featured''': yes/no flag; defaults no (Boolean).
* '''Owner''': Required; username for accountability (Text; stores as User: page).
* '''URL''': Optional; external link (URL).
* '''Author''': Optional; creator/author (Text).
* '''Content''': Auto-passed; main body wikitext (e.g., why this resource works).
 
=== Validation ===
- **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.
</noinclude>
</noinclude>

Revision as of 08:01, 21 September 2025

Template:Resource

Master template for Resource entries. Call via type wrappers only (e.g.,

No image provided


Type Book





Book






false




). Handles infobox and shared semantics for headless API pulls.