Jump to content

Template:Knowledge: Difference between revisions

From WYOS Wiki
No edit summary
No edit summary
 
(14 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:
{{!}}-
{{!}}-
! Format
! Format
{{!}} {{{Knowledge Format}}}
{{!}} [[{{{Knowledge Format}}}]]
}}
}}
{{#if:{{{Author|}}}|
{{#if:{{{Author|}}}|
Line 45: Line 45:
{{!}}-
{{!}}-
! Topics
! Topics
{{!}} {{{Topic Tags}}}
{{!}} {{#arraymap:{{{Topic Tags|}}}|,|x|[[x|{{#replace:x|Tag:|}}]]|,&#32;}}
}}
}}
{{#if:{{{Status|}}}|
{{#if:{{{Status|}}}|
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]] -->
[[Has status::{{{Status|Draft}}}]]
{{#if:{{{Knowledge Format|}}}
| [[Has knowledge format::{{{Knowledge Format}}}]]
}}
{{#if:{{{Original Source|}}}
| [[Has original source::{{{Original Source}}}]]
}}


<!-- Controlled vocab / state (Text types; enforce via forms) -->
<!-- Set standard properties only if a value is provided. -->
[[Has status::{{{Status|Draft}}}]]
{{#if:{{{Display Title|}}}
{{#if:{{{Knowledge Format|}}}|[[Has knowledge format::{{{Knowledge Format}}}]]}}
| [[Has display title::{{{Display Title}}}]]
{{#if:{{{Original Source|}}}|[[Has original source::{{{Original Source}}}]]}}
}}
{{#if:{{{Subtitle|}}}
| [[Has subtitle::{{{Subtitle}}}]]
}}
{{#if:{{{Description|}}}
| [[Has description::{{{Description}}}]]
}}
{{#if:{{{URL|}}}
| [[Has url::{{{URL}}}]]
}}
{{#if:{{{Author|}}}
| [[Has author::{{{Author}}}]]
}}
{{#if:{{{Original Title|}}}
| [[Has original title::{{{Original Title}}}]]
}}


<!-- Standard props (Text/Page/URL) -->
<!-- Robust Owner Handling: Adds 'User:' prefix only if it's missing. -->
{{#if:{{{Display Title|}}}|[[Has display title::{{{Display Title}}}]]}}
{{#if:{{{Owner|}}}
{{#if:{{{Subtitle|}}}|[[Has subtitle::{{{Subtitle}}}]]}
| [[Has owner::{{#ifeq:{{lc:{{#titleparts:{{{Owner}}}|1|1}}}}|user|{{{Owner}}}|User:{{{Owner}}}}}]]
{{#if:{{{Description|}}}|[[Has description::{{{Description}}}]]}}
}}
{{#if:{{{URL|}}}|[[Has url::{{{URL}}}]]}}
{{#if:{{{Author|}}}|[[Has author::{{{Author}}}]]}}
{{#if:{{{Original Title|}}}|[[Has original title::{{{Original Title}}}]]}}
{{#if:{{{Owner|}}}|[[Has owner::{{{Owner}}}]]}}


<!-- Robust image (File type) -->
<!-- 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}}}}}}]}
{{#if:{{{Image|}}}
| [[Has image::{{#ifeq:{{lc:{{#titleparts:{{{Image}}}|1|1}}}}|file|{{{Image}}}|File:{{{Image}}}}}]]
}}


<!-- Boolean (true/false for queries) -->
<!-- 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) -->
<!-- Normalize Topic Tags to Tag: namespace and set multi-value Page property -->
{{#if:{{{Topic Tags|}}}|{{#arraymap:{{{Topic Tags|}}}|,|x|[[Has topic tag::{{#trim:x}}]]}}}
{{#if:{{{Topic Tags|}}}
| {{#arraymap:{{{Topic Tags|}}}|,|x|[[Has topic tag::x]]|\s}}
}}
</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., <nowiki>{{Summary|…}}</nowiki>). 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.
<templatedata>
 
{
=== Parameters ===
  "params": {
* '''Display Title''': Required; user-facing title (Text).
    "Image": {
* '''Subtitle''': Optional; tagline (Text).
      "label": "Image",
* '''Description''': Optional; card teaser (Text).
      "description": "The filename of the image to display in the infobox (e.g., \"My_Book_Cover.jpg\").",
* '''Image''': Optional; filename, auto-prefixes File: (File).
      "type": "wiki-file-name"
* '''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).
    "Display Title": {
* '''Status''': Publication state; defaults Draft (Text; controlled: Draft|Published|Archived).
      "label": "Display Title",
* '''Is Featured''': yes/no flag; defaults no (Boolean).
      "description": "The primary, user-facing title of the entry.",
* '''Owner''': Required; username for accountability (Text).
      "type": "line"
* '''URL''': Optional; external link (URL).
    },
* '''Author''': Optional; original creator (Text).
    "Subtitle": {
* '''Original Title''': Optional; source title (Text).
      "label": "Subtitle",
* '''Original Source''': Optional; e.g., Book|Article (Text; controlled vocab via forms).
      "description": "A short, descriptive tagline that appears below the main title.",
* '''Content''': Auto-passed; main body wikitext.
      "type": "line"
 
    },
=== Validation ===
    "Knowledge Format": {
- **Test Query**: On a sample page: `[[Has topic tag::Tag:Habits]] [[Has status::Published]]`—should annotate correctly, queryable via API.
      "label": "Knowledge Format",
- **Edge Case**: Empty tags defaults to no property (avoids blank arrays); boolean false hides from featured lists.
      "description": "The format of the entry. This is set automatically by the wrapper template and should not be changed.",
 
      "example": "Summaries",
Next: Audit format-specific wrappers (e.g., Template:Summary)?
      "type": "wiki-page-name",
</noinclude>
      "suggestedvalues": [
        "Summaries",
        "Guides",
        "Frameworks & Models",
        "Big Ideas",
        "Tips & Tactics",
        "Quick Insights",
        "Visuals"
      ],
      "suggested": true
    },
    "Author": {
      "label": "Author",
      "description": "The original creator of the work (e.g., the book's author).",
      "type": "line"
    },
    "Original Title": {
      "label": "Original Title",
      "description": "The official title of the original work being summarized.",
      "type": "line"
    },
    "Original Source": {
      "label": "Original Source",
      "description": "The type of the original work.",
      "example": "Book",
      "type": "line"
    },
    "URL": {
      "label": "URL",
      "description": "A relevant external link, such as to the original article or a purchase page.",
      "type": "url"
    },
    "Topic Tags": {
      "label": "Topic Tags",
      "description": "A comma-separated list of relevant Topic Tags. You may enter either \"Tag:Habits, Tag:Productivity\" or \"Habits, Productivity\".",
      "type": "line",
      "required": true
    },
    "Status": {
      "label": "Status",
      "description": "The publication status of the entry. \"Draft\" keeps it hidden from public view.",
      "type": "line",
      "suggestedvalues": ["Draft","Published","Archived"],
      "default": "Draft",
      "required": true
    },
    "Is Featured": {
      "label": "Featured?",
      "description": "Set to 'yes' to highlight this content on hub pages.",
      "type": "boolean"
    },
    "Owner": {
      "label": "Owner",
      "description": "The username of the person responsible for this content's accuracy (do not include the \"User:\" prefix).",
      "type": "wiki-user-name",
      "required": true
    },
    "Description": {
      "label": "Description",
      "description": "The short, 1–2 sentence summary used on content cards across the site.",
      "type": "string",
      "required": true
    },
    "Content": {
      "label": "Main Content",
      "description": "The main body of the article. This is a free-form text area that supports standard wikitext/VE.",
      "type": "content",
      "suggested": true
    }
  },
  "description": "Master template for all Knowledge entries. Handles infobox and shared semantics. Should only be called by a format-specific wrapper template.",
  "format": "block"
}
</templatedata></noinclude>

Latest revision as of 23:24, 23 September 2025

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 all Knowledge entries. Handles infobox and shared semantics. Should only be called by a format-specific wrapper template.

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
ImageImage

The filename of the image to display in the infobox (e.g., "My_Book_Cover.jpg").

Fileoptional
Display TitleDisplay Title

The primary, user-facing title of the entry.

Lineoptional
SubtitleSubtitle

A short, descriptive tagline that appears below the main title.

Lineoptional
Knowledge FormatKnowledge Format

The format of the entry. This is set automatically by the wrapper template and should not be changed.

Suggested values
Summaries Guides Frameworks & Models Big Ideas Tips & Tactics Quick Insights Visuals
Example
Summaries
Page namesuggested
AuthorAuthor

The original creator of the work (e.g., the book's author).

Lineoptional
Original TitleOriginal Title

The official title of the original work being summarized.

Lineoptional
Original SourceOriginal Source

The type of the original work.

Example
Book
Lineoptional
URLURL

A relevant external link, such as to the original article or a purchase page.

URLoptional
Topic TagsTopic Tags

A comma-separated list of relevant Topic Tags. You may enter either "Tag:Habits, Tag:Productivity" or "Habits, Productivity".

Linerequired
StatusStatus

The publication status of the entry. "Draft" keeps it hidden from public view.

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

Set to 'yes' to highlight this content on hub pages.

Booleanoptional
OwnerOwner

The username of the person responsible for this content's accuracy (do not include the "User:" prefix).

Userrequired
DescriptionDescription

The short, 1–2 sentence summary used on content cards across the site.

Stringrequired
Main ContentContent

The main body of the article. This is a free-form text area that supports standard wikitext/VE.

Contentsuggested