Jump to content

Template:Resource: Difference between revisions

From WYOS Wiki
No edit summary
No edit summary
Line 1: Line 1:
<includeonly>
<includeonly>
<!--  
<!--
   ==================================================================
   ==================================================================
   == VISIBLE INFOBOX - This section only displays data.
   == VISIBLE INFOBOX - Conditional display for wiki/admin views.
  == 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
! Topics
{{!}} {{{Topic Tags}}}
{{!}} {{{Topic Tags}}}
}}
}}
{{#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
{{!}} [[User:{{{Owner}}}|{{{Owner}}}]]
}}
{{#if:{{{Description|}}}|
{{!}}-
! Description
! Description
{{!}} {{{Description}}}
{{!}} {{{Description}}}
Line 46: Line 59:
|}
|}


<!--  
<!--
   ==================================================================
   ==================================================================
   == HIDDEN SEMANTIC DATA - This is the single source of truth for  
   == HIDDEN SEMANTIC DATA - Single source for API queries.
  == 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 -->
<!-- RECOMMENDED: Do NOT set Belongs to platform section here (Topic Cards decide hub placement). -->
[[Has status::{{{Status|Published}}}]]
<!-- ALTERNATIVE (if needed): [[Belongs to platform section::Resources]] -->
 
<!-- Controlled vocab / state (Text types; enforce via forms) -->
[[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 -->
<!-- Standard props (Text/Page/URL) -->
{{#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}}}]]}}
{{#if:{{{Image|}}}|[[Has image::{{{Image}}}]]}}
{{#if:{{{Description|}}}|[[Has description::{{{Description}}}]]}}
{{#if:{{{Description|}}}|[[Has description::{{{Description}}}]]}}
{{#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}}}]]}}


<!-- Set boolean property -->
<!-- Robust image (File type) -->
[[Is featured::{{#ifeq:{{lc:{{{Is Featured|no}}}}}|yes|yes|no}}]]
{{#if:{{{Image|}}}|[[Has image::{{#ifeq:{{lc:{{#titleparts:{{{Image}}}|1|1}}}}|file|{{{Image}}}|File:{{{Image}}}}}]]}}


<!-- Set multi-value 'Page' property -->
<!-- Boolean (true/false for queries) -->
{{#arraymap:{{{Topic Tags|}}}|,|x|[[Has topic tag::x]]}}
[[Is featured::{{#ifeq:{{lc:{{{Is Featured|no}}}}}|yes|true|false}}]]
 
<!-- Multi-value tags (Page type; trims spaces, comma-separated Tag: pages) -->
{{#if:{{{Topic Tags|}}}|{{#arraymap:{{{Topic Tags|}}}|,|x|[[Has topic tag::{{#trim:x}}]]}}}
</div>
</div>


<!--  
<!--
   ==================================================================
   ==================================================================
   == CONTENT SECTION - Populated by resource type-specific templates.
   == CONTENT - Populated by type-specific wrappers (e.g., Template:Book).
   ==================================================================
   ==================================================================
-->
-->
{{{Content|}}}
{{{Content|}}}
</includeonly><noinclude>
</includeonly><noinclude>
'''Template:Resource'''
'''Template:Resource'''


This is the MASTER template for all Resource section entries. It should NOT be called directly.
Master template for Resource entries—call via type wrappers only (e.g., {{Book}}). Handles infobox and shared semantics for headless API pulls.
This template handles the infobox display and assigns all shared semantic properties.
 
Use a type-specific wrapper template (e.g., Template:Book, Template:App), which will call this one and provide the necessary data.


=== Parameters ===
=== Parameters ===
* '''Image''': The filename of the main image (e.g., "My_Awesome_Image.jpg").
* '''Display Title''': Required; user-facing title (Text).
* '''Display Title''': The primary title shown to users.
* '''Subtitle''': Optional; tagline (Text).
* '''Subtitle''': The secondary title or tagline.
* '''Description''': Optional; card teaser (Text).
* '''Resource Type''': The type of the resource (e.g., [[Book]]). Must be a link to the type page.
* '''Image''': Optional; filename, auto-prefixes File: (File).
* '''Author''': The author or creator of the resource (e.g., for books, courses).
* '''Resource Type''': Auto-passed by wrapper (Page; controlled: Apps|Books|etc.).
* '''URL''': The primary external link for the resource.
* '''Topic Tags''': Required; comma-separated Tag: pages (e.g., Tag:Productivity,Tag:Habits) for multi-value filtering (Page).
* '''Topic Tags''': A comma-separated list of links to topic pages (e.g., [[Habits]], [[Deep Work]]). This is critical for discovery.
* '''Status''': Publication state; defaults Draft (Text; controlled: Draft|Published|Archived).
* '''Status''': The publication status (Published, Draft, Archived). Defaults to "Published".
* '''Is Featured''': yes/no flag; defaults no (Boolean).
* '''Is Featured''': A "yes" or "no" flag to feature the content. Defaults to "no".
* '''Owner''': Required; username for accountability (Text; stores as User: page).
* '''Description''': The short summary used on content cards.
* '''URL''': Optional; external link (URL).
* '''Content''': This parameter is reserved for the main body of the resource description, passed in from a type-specific template.
* '''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 06:35, 21 September 2025

Template:Resource

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

No image provided


Type Book





Book






false

{{#if:|}


). 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**: `The part "]]" of the query was not understood.</br>Results might not be as expected.`—lists owned Books.