Jump to content

Template:Knowledge: Difference between revisions

From WYOS Wiki
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 45: Line 45:
{{!}}-
{{!}}-
! Topics
! Topics
{{!}} {{{Topic Tags}}}
{{!}} {{#arraymap:{{{Topic Tags|}}}|,|x|[[x|{{#replace:x|Tag:|}}]]|, }}
}}
}}
{{#if:{{{Status|}}}|
{{#if:{{{Status|}}}|
Line 60: Line 60:
{{!}}-
{{!}}-
! Owner
! Owner
{{!}} [[{{#ifeq:{{lc:{{#titleparts:{{{Owner}}}|1|1}}}}|user|{{{Owner}}}|User:{{{Owner}}}}}|{{#replace:{{{Owner}}}|User:|}}]]
{{!}} [[User:{{{Owner}}}|{{{Owner}}}]]
}}
}}
{{#if:{{{Description|}}}|
{{#if:{{{Description|}}}|
Line 79: Line 79:
<!-- Set controlled vocabulary properties. Default status is 'Draft'. -->
<!-- Set controlled vocabulary properties. Default status is 'Draft'. -->
[[Has status::{{{Status|Draft}}}]]
[[Has status::{{{Status|Draft}}}]]
{{#if:{{{Knowledge Format|}}}|[[Has knowledge format::{{{Knowledge Format}}}]]}}
{{#if:{{{Knowledge Format|}}}
{{#if:{{{Original Source|}}}|[[Has original source::{{{Original Source}}}]]}}
| [[Has knowledge format::{{{Knowledge Format}}}]]
}}
{{#if:{{{Original Source|}}}
| [[Has original source::{{{Original Source}}}]]
}}


<!-- Set standard properties only if a value is provided. -->
<!-- Set standard properties only if a value is provided. -->
{{#if:{{{Display Title|}}}|[[Has display title::{{{Display Title}}}]]}}
{{#if:{{{Display Title|}}}
{{#if:{{{Subtitle|}}}|[[Has subtitle::{{{Subtitle}}}]]}}
| [[Has display title::{{{Display Title}}}]]
{{#if:{{{Description|}}}|[[Has description::{{{Description}}}]]}}
}}
{{#if:{{{URL|}}}|[[Has url::{{{URL}}}]]}}
{{#if:{{{Subtitle|}}}
{{#if:{{{Author|}}}|[[Has author::{{{Author}}}]]}}
| [[Has subtitle::{{{Subtitle}}}]]
{{#if:{{{Original Title|}}}|[[Has original title::{{{Original Title}}}]]}}
}}
{{#if:{{{Description|}}}
| [[Has description::{{{Description}}}]]
}}
{{#if:{{{URL|}}}
| [[Has url::{{{URL}}}]]
}}
{{#if:{{{Author|}}}
| [[Has author::{{{Author}}}]]
}}
{{#if:{{{Original Title|}}}
| [[Has original title::{{{Original Title}}}]]
}}


<!-- Robust Owner Handling: Adds 'User:' prefix only if it's missing. -->
<!-- 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}}}}]]}}
{{#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. -->
<!-- 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}}}}}]]
}}


<!-- Set boolean property to return true/false for the API. -->
<!-- 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}}]]


<!-- Set multi-value 'Page' property. #trim prevents errors from extra spaces. -->
<!-- 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>


Line 112: Line 134:
</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.,  
<nowiki>{{Summary|…}}</nowiki>). Handles infobox and shared semantics for headless API pulls.
<templatedata>
<templatedata>
{
{
"params": {
  "params": {
"Image": {
    "Image": {
"label": "Image",
      "label": "Image",
"description": "The filename of the image to display in the infobox (e.g., \"My_Book_Cover.jpg\").",
      "description": "The filename of the image to display in the infobox (e.g., \"My_Book_Cover.jpg\").",
"type": "wiki-file-name"
      "type": "wiki-file-name"
},
    },
"Display Title": {
    "Display Title": {
"label": "Display Title",
      "label": "Display Title",
"description": "The primary, user-facing title of the entry.",
      "description": "The primary, user-facing title of the entry.",
"type": "line"
      "type": "line"
},
    },
"Subtitle": {
    "Subtitle": {
"label": "Subtitle",
      "label": "Subtitle",
"description": "A short, descriptive tagline that appears below the main title.",
      "description": "A short, descriptive tagline that appears below the main title.",
"type": "line"
      "type": "line"
},
    },
"Knowledge Format": {
    "Knowledge Format": {
"label": "Knowledge Format",
      "label": "Knowledge Format",
"description": "The format of the entry. This is set automatically by the wrapper template and should not be changed.",
      "description": "The format of the entry. This is set automatically by the wrapper template and should not be changed.",
"example": "Summary",
      "example": "Summaries",
"type": "wiki-page-name",
      "type": "wiki-page-name",
"suggestedvalues": [
      "suggestedvalues": [
"Summary",
        "Summaries",
"Guide",
        "Guides",
"Big Idea",
        "Frameworks & Models",
"Tips",
        "Big Ideas",
"Visual",
        "Tips & Tactics",
"Framework",
        "Quick Insights",
"Quick Insight"
        "Visuals"
],
      ],
"suggested": true
      "suggested": true
},
    },
"Author": {
    "Author": {
"label": "Author",
      "label": "Author",
"description": "The original creator of the work (e.g., the book's author).",
      "description": "The original creator of the work (e.g., the book's author).",
"type": "line"
      "type": "line"
},
    },
"Original Title": {
    "Original Title": {
"label": "Original Title",
      "label": "Original Title",
"description": "The official title of the original work being summarized.",
      "description": "The official title of the original work being summarized.",
"type": "line"
      "type": "line"
},
    },
"Original Source": {
    "Original Source": {
"label": "Original Source",
      "label": "Original Source",
"description": "The type of the original work.",
      "description": "The type of the original work.",
"example": "Book",
      "example": "Book",
"type": "line"
      "type": "line"
},
    },
"URL": {
    "URL": {
"label": "URL",
      "label": "URL",
"description": "A relevant external link, such as to the original article or a purchase page.",
      "description": "A relevant external link, such as to the original article or a purchase page.",
"type": "url"
      "type": "url"
},
    },
"Topic Tags": {
    "Topic Tags": {
"label": "Tags",
      "label": "Topic Tags",
"description": "A comma-separated list of relevant Topic Tags. You must use the full page name.",
      "description": "A comma-separated list of relevant Topic Tags. You may enter either \"Tag:Habits, Tag:Productivity\" or \"Habits, Productivity\".",
"type": "line",
      "type": "line",
"required": true
      "required": true
},
    },
"Status": {
    "Status": {
"label": "Status",
      "label": "Status",
"description": "The publication status of the entry. \"Draft\" keeps it hidden from public view.",
      "description": "The publication status of the entry. \"Draft\" keeps it hidden from public view.",
"type": "line",
      "type": "line",
"suggestedvalues": [
      "suggestedvalues": ["Draft","Published","Archived"],
"Draft",
      "default": "Draft",
"Published",
      "required": true
"Archived"
    },
],
    "Is Featured": {
"default": "Draft",
      "label": "Featured?",
"required": true
      "description": "Set to 'yes' to highlight this content on hub pages.",
},
      "type": "boolean"
"Is Featured": {
    },
"label": "Featured?",
    "Owner": {
"description": "Set to 'yes' to highlight this content on hub pages.",
      "label": "Owner",
"type": "boolean"
      "description": "The username of the person responsible for this content's accuracy (do not include the \"User:\" prefix).",
},
      "type": "wiki-user-name",
"Owner": {
      "required": true
"label": "Owner",
    },
"description": "The username of the person responsible for this content's accuracy (do not include the \"User:\" prefix).",
    "Description": {
"type": "wiki-user-name",
      "label": "Description",
"required": true
      "description": "The short, 1–2 sentence summary used on content cards across the site.",
},
      "type": "string",
"Description": {
      "required": true
"label": "Description",
    },
"description": "The short, 1-2 sentence summary used on content cards across the site.",
    "Content": {
"type": "string",
      "label": "Main Content",
"required": true
      "description": "The main body of the article. This is a free-form text area that supports standard wikitext/VE.",
},
      "type": "content",
"Content": {
      "suggested": true
"label": "Main Content",
    }
"description": "The main body of the article. This is a free-form text area that supports all standard wikitext formatting.",
  },
"type": "content",
  "description": "Master template for all Knowledge entries. Handles infobox and shared semantics. Should only be called by a format-specific wrapper template.",
"suggested": true
  "format": "block"
}
},
"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>
</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