Jump to content

Template:Topic Card: Difference between revisions

From WYOS Wiki
No edit summary
No edit summary
Line 18: Line 18:
|-
|-
! Tags (for query)
! Tags (for query)
| {{{Queries for Tag|}}}
| {{#arraymap:{{{Queries for Tag|}}}|,|t|
    {{#ifeq:{{lc:{{#titleparts:{{#trim:t}}|1|1}}}}|tag
      | [[{{#trim:t}}|{{#replace:{{#trim:t}}|Tag:|}}]]
      | [[Tag:{{#trim:t}}|{{#trim:t}}]]
    }}
  |, }}
{{#if:{{{Match Mode|}}}|
{{#if:{{{Match Mode|}}}|
|-
|-
Line 27: Line 32:
|-
|-
! Excludes Tag
! Excludes Tag
| {{{Excludes Tag}}}
| {{#arraymap:{{{Excludes Tag|}}}|,|e|
    {{#ifeq:{{lc:{{#titleparts:{{#trim:e}}|1|1}}}}|tag
      | [[{{#trim:e}}|{{#replace:{{#trim:e}}|Tag:|}}]]
      | [[Tag:{{#trim:e}}|{{#trim:e}}]]
    }}
  |, }}
}}
}}
|}
|}


<!-- Hidden Semantic Data (this is the critical part for your headless CMS) -->
<!-- Hidden Semantic Data (headless CMS source of truth) -->
<div style="display:none;">
<div style="display:none;">
[[Has display title::{{{Display Title|}}}]]
[[Has display title::{{{Display Title|}}}]]
[[Has card image::{{{Card Image|}}}]]
 
<!-- Robust image handling: add File: if missing -->
{{#if:{{{Card Image|}}}
| [[Has card image::{{#ifeq:{{lc:{{#titleparts:{{{Card Image}}}|1|1}}}}|file|{{{Card Image}}}|File:{{{Card Image}}}}}]]
}}
 
[[Has card description::{{{Card Description|}}}]]
[[Has card description::{{{Card Description|}}}]]


[[Appears in main category::{{{Appears in Main Category|}}}]]
{{#if:{{{Appears in Main Category|}}}
[[Belongs to platform section::{{{Belongs to Platform Section|}}}]]
| [[Appears in main category::{{{Appears in Main Category}}}]]
}}
{{#if:{{{Belongs to Platform Section|}}}
| [[Belongs to platform section::{{{Belongs to Platform Section}}}]]
}}


<!-- Multi-value property for tags to query. #trim removes accidental spaces. -->
<!-- Normalize tag inputs to Tag: namespace -->
{{#arraymap:{{{Queries for Tag|}}}|,|x|[[Queries for tag::{{#trim:x}}]]}}
{{#if:{{{Queries for Tag|}}}
| {{#arraymap:{{{Queries for Tag|}}}|,|x|
    [[Queries for tag::{{#ifeq:{{lc:{{#titleparts:{{#trim:x}}|1|1}}}}|tag
      | {{#trim:x}}
      | Tag:{{#trim:x}}
    }}]]
  }}
}}


<!-- Optional: multi-value property for tags to exclude. -->
{{#if:{{{Excludes Tag|}}}
{{#if:{{{Excludes Tag|}}}|{{#arraymap:{{{Excludes Tag|}}}|,|y|[[Excludes tag::{{#trim:y}}]]}}}}
| {{#arraymap:{{{Excludes Tag|}}}|,|y|
    [[Excludes tag::{{#ifeq:{{lc:{{#titleparts:{{#trim:y}}|1|1}}}}|tag
      | {{#trim:y}}
      | Tag:{{#trim:y}}
    }}]]
  }}
}}


<!-- Optional: sets the query logic. Defaults to 'ANY' (OR logic). -->
[[Match mode::{{{Match Mode|ANY}}}]]
[[Match mode::{{{Match Mode|ANY}}}]]


<!-- Sets the publication status. Defaults to 'Draft'. -->
<!-- Publication status (Draft by default) -->
[[Has status::{{{Status|Draft}}}]]
[[Has status::{{{Status|Draft}}}]]


<!-- Assigns this page to the correct category for management. -->
[[Category:Topic Cards]]
[[Category:Topic Cards]]
</div>
</div>
</includeonly><noinclude>
</includeonly><noinclude>
This template is for creating Topic Cards, which act as curated entry points on the main hub pages.
This template creates a Topic Card (curated entry point for hub pages).


== Parameters ==
<templatedata>
; Display Title : (Text) The main title shown on the card.
{
; Card Image : (File) The image file used on the card (e.g., "Topic_habits.webp").
  "params": {
; Card Description : (Text) The short teaser text for the card.
    "Display Title": {
; Appears in Main Category : (Page) The Main Category page where this card should appear (e.g., "Master Yourself").
      "label": "Display Title",
; Belongs to Platform Section : (Text) Exactly "Knowledge" or "Resources".
      "description": "Main title shown on the card.",
; Queries for Tag : (Comma-separated Page Titles) The Tag pages to pull content from (e.g., "Tag:Habits,Tag:Routines").
      "type": "line",
; Excludes Tag : (Optional, Comma-separated Page Titles) Tag pages to exclude from the results.
      "required": true
; Match Mode : (Optional, Text) "ANY" or "ALL". Defaults to "ANY".
    },
; Status : (Text) "Draft", "Published", or "Archived". Defaults to "Draft".
    "Card Image": {
      "label": "Card Image",
      "description": "Image file for the card (e.g., \"Topic_habits.webp\").",
      "type": "wiki-file-name"
    },
    "Card Description": {
      "label": "Card Description",
      "description": "Short teaser text for the card.",
      "type": "string",
      "required": true
    },
    "Appears in Main Category": {
      "label": "Appears in Main Category",
      "description": "Main Category page where this card appears (e.g., \"Master Yourself\").",
      "type": "wiki-page-name",
      "required": true
    },
    "Belongs to Platform Section": {
      "label": "Platform Section",
      "description": "Exactly \"Knowledge\" or \"Resources\".",
      "type": "line",
      "suggestedvalues": ["Knowledge","Resources"],
      "required": true
    },
    "Queries for Tag": {
      "label": "Tags (for query)",
      "description": "Comma-separated Tag pages. Accepts either \"Tag:Habits, Tag:Routines\" or \"Habits, Routines\".",
      "type": "line",
      "required": true
    },
    "Excludes Tag": {
      "label": "Excludes Tag",
      "description": "Optional comma-separated Tag pages to exclude.",
      "type": "line"
    },
    "Match Mode": {
      "label": "Match Mode",
      "description": "\"ANY\" (OR) or \"ALL\" (AND). Defaults to ANY.",
      "type": "line",
      "suggestedvalues": ["ANY","ALL"]
    },
    "Status": {
      "label": "Status",
      "description": "\"Draft\", \"Published\", or \"Archived\". Defaults to \"Draft\".",
      "type": "line",
      "suggestedvalues": ["Draft","Published","Archived"],
      "default": "Draft"
    }
  },
  "description": "Template for Topic Cards used on hub pages.",
  "format": "block"
}
</templatedata>
</noinclude>
</noinclude>

Revision as of 18:30, 21 September 2025

This template creates a Topic Card (curated entry point for hub pages).

Template for Topic Cards used on hub pages.

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Display TitleDisplay Title

Main title shown on the card.

Linerequired
Card ImageCard Image

Image file for the card (e.g., "Topic_habits.webp").

Fileoptional
Card DescriptionCard Description

Short teaser text for the card.

Stringrequired
Appears in Main CategoryAppears in Main Category

Main Category page where this card appears (e.g., "Master Yourself").

Page namerequired
Platform SectionBelongs to Platform Section

Exactly "Knowledge" or "Resources".

Suggested values
Knowledge Resources
Linerequired
Tags (for query)Queries for Tag

Comma-separated Tag pages. Accepts either "Tag:Habits, Tag:Routines" or "Habits, Routines".

Linerequired
Excludes TagExcludes Tag

Optional comma-separated Tag pages to exclude.

Lineoptional
Match ModeMatch Mode

"ANY" (OR) or "ALL" (AND). Defaults to ANY.

Suggested values
ANY ALL
Lineoptional
StatusStatus

"Draft", "Published", or "Archived". Defaults to "Draft".

Suggested values
Draft Published Archived
Default
Draft
Lineoptional