Template:Resource: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
<!-- | <!-- | ||
================================================================== | ================================================================== | ||
== VISIBLE INFOBOX - | == VISIBLE INFOBOX - Conditional display for wiki/admin views. | ||
================================================================== | ================================================================== | ||
--> | --> | ||
{| 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 - | == HIDDEN SEMANTIC DATA - Single source for API queries. | ||
================================================================== | ================================================================== | ||
--> | --> | ||
<div style="display:none;"> | <div style="display:none;"> | ||
[[Category:Resources]] | [[Category:Resources]] | ||
<!-- | <!-- RECOMMENDED: Do NOT set Belongs to platform section here (Topic Cards decide hub placement). --> | ||
[[Has status::{{{Status| | <!-- 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}}}]]}} | ||
<!-- | <!-- 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:{{{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}}}]]}} | |||
<!-- | <!-- Robust image (File type) --> | ||
[[ | {{#if:{{{Image|}}}|[[Has image::{{#ifeq:{{lc:{{#titleparts:{{{Image}}}|1|1}}}}|file|{{{Image}}}|File:{{{Image}}}}}]]}} | ||
<!-- | <!-- 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 | == CONTENT - Populated by type-specific wrappers (e.g., Template:Book). | ||
================================================================== | ================================================================== | ||
--> | --> | ||
{{{Content|}}} | {{{Content|}}} | ||
</includeonly><noinclude> | </includeonly><noinclude> | ||
'''Template:Resource''' | '''Template:Resource''' | ||
Master template for Resource entries—call via type wrappers only (e.g., {{Book}}). Handles infobox and shared semantics for headless API pulls. | |||
=== Parameters === | === Parameters === | ||
* '''Display Title''': Required; user-facing title (Text). | |||
* '''Display Title''': | * '''Subtitle''': Optional; tagline (Text). | ||
* '''Subtitle''': | * '''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). | ||
* '''Topic Tags''': | * '''Status''': Publication state; defaults Draft (Text; controlled: Draft|Published|Archived). | ||
* '''Status''': | * '''Is Featured''': yes/no flag; defaults no (Boolean). | ||
* '''Is Featured''': | * '''Owner''': Required; username for accountability (Text; stores as User: page). | ||
* ''' | * '''URL''': Optional; external link (URL). | ||
* '''Content''': | * '''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
|
|---|---|
). 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.