Jump to content

Template:Knowledge: 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:
{{!}}-
{{!}}-
! Format
! Format
{{!}} {{{Knowledge Format}}}
{{!}} [[{{{Knowledge Format}}}]]
}}
}}
{{#if:{{{Author|}}}|
{{#if:{{{Author|}}}|
Line 60: Line 60:
{{!}}-
{{!}}-
! Owner
! Owner
{{!}} [[User:{{{Owner}}}|{{{Owner}}}]]
{{!}} [[{{#ifeq:{{lc:{{#titleparts:{{{Owner}}}|1|1}}}}|user|{{{Owner}}}|User:{{{Owner}}}}}|{{#replace:{{{Owner}}}|User:|}}]]
}}
}}
{{#if:{{{Description|}}}|
{{#if:{{{Description|}}}|
Line 71: Line 71:
<!--
<!--
   ==================================================================
   ==================================================================
   == HIDDEN SEMANTIC DATA - Single source for API queries.
   == HIDDEN SEMANTIC DATA - The single source of truth for your headless CMS.
   ==================================================================
   ==================================================================
-->
-->
Line 77: Line 77:
[[Category:Knowledge]]
[[Category:Knowledge]]


<!-- 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::Knowledge]] -->
 
<!-- Controlled vocab / state (Text types; enforce via forms) -->
[[Has status::{{{Status|Draft}}}]]
[[Has status::{{{Status|Draft}}}]]
{{#if:{{{Knowledge Format|}}}|[[Has knowledge format::{{{Knowledge Format}}}]]}}
{{#if:{{{Knowledge Format|}}}|[[Has knowledge format::[[{{{Knowledge Format}}}]]]]}}
{{#if:{{{Original Source|}}}|[[Has original source::{{{Original Source}}}]]}}
{{#if:{{{Original Source|}}}|[[Has original source::{{{Original Source}}}]]}}


<!-- 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 92: Line 89:
{{#if:{{{Author|}}}|[[Has author::{{{Author}}}]]}}
{{#if:{{{Author|}}}|[[Has author::{{{Author}}}]]}}
{{#if:{{{Original Title|}}}|[[Has original title::{{{Original Title}}}]]}}
{{#if:{{{Original Title|}}}|[[Has original title::{{{Original Title}}}]]}}
{{#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 format-specific wrappers (e.g., Template:Summary).
   == CONTENT - This displays the main body of the article.
   ==================================================================
   ==================================================================
-->
-->
{{{Content|}}}
{{{Content|}}}
</includeonly><noinclude>
</includeonly><noinclude>
'''Template:Knowledge'''
'''Template:Knowledge'''


Master template for Knowledge entries—call via format wrappers only (e.g., {{Summary}}). Handles infobox and shared semantics for headless API pulls.
Master template for Knowledge entries. Call via format wrappers only (e.g., {{Summary}}). 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).
* '''Knowledge Format''': Auto-passed by wrapper (Page; controlled: Guides|Summaries|etc.).
* '''Topic Tags''': Required; comma-separated Tag: pages (e.g., Tag:Habits,Tag:Productivity) 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).
* '''URL''': Optional; external link (URL).
* '''Author''': Optional; original creator (Text).
* '''Original Title''': Optional; source title (Text).
* '''Original Source''': Optional; e.g., Book|Article (Text; controlled vocab via forms).
* '''Content''': Auto-passed; main body wikitext.
 
=== Validation ===
- **Test Query**: On a sample page: `[[Has topic tag::Tag:Habits]] [[Has status::Published]]`—should annotate correctly, queryable via API.
- **Edge Case**: Empty tags defaults to no property (avoids blank arrays); boolean false hides from featured lists.
 
Next: Audit format-specific wrappers (e.g., Template:Summary)?
</noinclude>
</noinclude>

Revision as of 07:32, 21 September 2025

Template:Knowledge

Master template for Knowledge entries. Call via format wrappers only (e.g.,

No image provided


Format Summaries






[[Has knowledge format::Summaries]]







false




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