Template:Knowledge: Difference between revisions
No edit summary |
No edit summary |
||
| (12 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 | ||
{{!}} [[ | {{!}} [[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:: | {{#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}}]] | ||
<!-- | <!-- Normalize Topic Tags to Tag: namespace and set multi-value Page property --> | ||
{{#if:{{{Topic Tags|}}}|{{#arraymap:{{{Topic Tags|}}}|,|x|[[Has topic tag: | {{#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., {{Summary}}). Handles infobox and shared semantics for headless API pulls. | <templatedata> | ||
</noinclude> | { | ||
"params": { | |||
"Image": { | |||
"label": "Image", | |||
"description": "The filename of the image to display in the infobox (e.g., \"My_Book_Cover.jpg\").", | |||
"type": "wiki-file-name" | |||
}, | |||
"Display Title": { | |||
"label": "Display Title", | |||
"description": "The primary, user-facing title of the entry.", | |||
"type": "line" | |||
}, | |||
"Subtitle": { | |||
"label": "Subtitle", | |||
"description": "A short, descriptive tagline that appears below the main title.", | |||
"type": "line" | |||
}, | |||
"Knowledge Format": { | |||
"label": "Knowledge Format", | |||
"description": "The format of the entry. This is set automatically by the wrapper template and should not be changed.", | |||
"example": "Summaries", | |||
"type": "wiki-page-name", | |||
"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.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Image | Image | The filename of the image to display in the infobox (e.g., "My_Book_Cover.jpg"). | File | optional |
| Display Title | Display Title | The primary, user-facing title of the entry. | Line | optional |
| Subtitle | Subtitle | A short, descriptive tagline that appears below the main title. | Line | optional |
| Knowledge Format | Knowledge Format | The format of the entry. This is set automatically by the wrapper template and should not be changed.
| Page name | suggested |
| Author | Author | The original creator of the work (e.g., the book's author). | Line | optional |
| Original Title | Original Title | The official title of the original work being summarized. | Line | optional |
| Original Source | Original Source | The type of the original work.
| Line | optional |
| URL | URL | A relevant external link, such as to the original article or a purchase page. | URL | optional |
| Topic Tags | Topic Tags | A comma-separated list of relevant Topic Tags. You may enter either "Tag:Habits, Tag:Productivity" or "Habits, Productivity". | Line | required |
| Status | Status | The publication status of the entry. "Draft" keeps it hidden from public view.
| Line | required |
| Featured? | Is Featured | Set to 'yes' to highlight this content on hub pages. | Boolean | optional |
| Owner | Owner | The username of the person responsible for this content's accuracy (do not include the "User:" prefix). | User | required |
| Description | Description | The short, 1–2 sentence summary used on content cards across the site. | String | required |
| Main Content | Content | The main body of the article. This is a free-form text area that supports standard wikitext/VE. | Content | suggested |