Difference between revisions of "Template:ContentTemplateModernInline"

From Holdfast: Nations At War
Jump to navigation Jump to search
Line 1: Line 1:
 
<!-- ContentTemplateModernInline — MW 1.35 safe (no <main>/<aside>) -->
 
<!-- ContentTemplateModernInline — MW 1.35 safe (no <main>/<aside>) -->
 +
<!-- Changes:
 +
- Consistent pullup default (0.8em) for margin+padding.
 +
- Optional |two_col=yes to suppress right column even if image_content exists.
 +
- No leading spaces before HTML tags (prevents <pre> formatting).
 +
- Added TemplateData for VisualEditor fields.
 +
-->
  
 
{{HeaderTemplate|welcome={{{welcome|}}}|blurb={{{blurb|}}}}}
 
{{HeaderTemplate|welcome={{{welcome|}}}|blurb={{{blurb|}}}}}
Line 5: Line 11:
 
{{#switch:{{{layout|auto}}}
 
{{#switch:{{{layout|auto}}}
 
| stack =
 
| stack =
<div class="cpage" role="presentation"
+
<div class="cpage" role="presentation" style="display:block;border-top:1px solid transparent;margin-top:-{{{pullup|0.8em}}};padding-top:{{{pullup|0.8em}}};">
    style="display:block;border-top:1px solid transparent;margin-top:-{{{pullup|0.8em}}};padding-top:{{{pullup|1em}}};">
 
 
<div class="cpage__left" style="margin-bottom:{{{gap|1rem}}};">
 
<div class="cpage__left" style="margin-bottom:{{{gap|1rem}}};">
 
{{SectionTemplate|title={{{sections_title|Sections}}}|content={{{sections_content|}}}}}
 
{{SectionTemplate|title={{{sections_title|Sections}}}|content={{{sections_content|}}}}}
Line 15: Line 20:
 
{{#if:{{{news_content|}}}|{{SectionTemplate|title={{{news_title|News}}}|content={{{news_content}}}}}|}}
 
{{#if:{{{news_content|}}}|{{SectionTemplate|title={{{news_title|News}}}|content={{{news_content}}}}}|}}
 
</div>
 
</div>
{{#if:{{{image_content|}}}|<div class="cpage__aside" role="complementary">{{{image_content}}}</div>|}}
+
{{#ifexpr: {{#ifeq:{{{two_col|no}}}|yes|1|0}} + {{#if:{{{image_content|}}}|1|0}} = 2
 +
| <!-- two_col=yes AND image present: suppress aside -->
 +
|
 +
  {{#if:{{{image_content|}}}|<div class="cpage__aside" role="complementary">{{{image_content}}}</div>|}}
 +
}}
 
</div>
 
</div>
 +
 
| #default =
 
| #default =
<div class="cpage" role="presentation"
+
<div class="cpage" role="presentation" style="display:flex;align-items:flex-start;gap:{{{gap|1rem}}};border-top:1px solid transparent;margin-top:-{{{pullup|0.8em}}};padding-top:{{{pullup|0.8em}}};">
    style="display:flex;align-items:flex-start;gap:{{{gap|1rem}}};border-top:1px solid transparent;margin-top:-{{{pullup|0.8em}}};padding-top:{{{pullup|0.8em}}};">
 
 
<div class="cpage__left" style="flex:0 0 {{{left_width|320px}}};min-width:260px;">
 
<div class="cpage__left" style="flex:0 0 {{{left_width|320px}}};min-width:260px;">
 
{{SectionTemplate|title={{{sections_title|Sections}}}|content={{{sections_content|}}}}}
 
{{SectionTemplate|title={{{sections_title|Sections}}}|content={{{sections_content|}}}}}
Line 28: Line 37:
 
{{#if:{{{news_content|}}}|{{SectionTemplate|title={{{news_title|News}}}|content={{{news_content}}}}}|}}
 
{{#if:{{{news_content|}}}|{{SectionTemplate|title={{{news_title|News}}}|content={{{news_content}}}}}|}}
 
</div>
 
</div>
{{#if:{{{image_content|}}}|<div class="cpage__aside" role="complementary" style="flex:0 0 {{{aside_width|320px}}};min-width:260px;">{{{image_content}}}</div>|}}
+
{{#ifexpr: {{#ifeq:{{{two_col|no}}}|yes|1|0}} + {{#if:{{{image_content|}}}|1|0}} = 2
 +
| <!-- two_col=yes AND image present: suppress aside -->
 +
|
 +
  {{#if:{{{image_content|}}}|<div class="cpage__aside" role="complementary" style="flex:0 0 {{{aside_width|320px}}};min-width:260px;">{{{image_content}}}</div>|}}
 +
}}
 
</div>
 
</div>
 
}}
 
}}
Line 34: Line 47:
 
{{#ifeq:{{{show_toc|no}}}|yes||__NOTOC__}}
 
{{#ifeq:{{{show_toc|no}}}|yes||__NOTOC__}}
 
{{#ifeq:{{{show_section_edit|no}}}|yes||__NOEDITSECTION__}}
 
{{#ifeq:{{{show_section_edit|no}}}|yes||__NOEDITSECTION__}}
 +
 +
<!-- VisualEditor TemplateData -->
 +
<templatedata>
 +
{
 +
  "description": "Modern inline, 2–3 column content layout for Holdfast wiki (no site CSS required).",
 +
  "params": {
 +
    "welcome": {
 +
      "label": "Welcome headline",
 +
      "description": "Big page header text",
 +
      "type": "string",
 +
      "suggested": true
 +
    },
 +
    "blurb": {
 +
      "label": "Blurb",
 +
      "description": "Tagline under the header",
 +
      "type": "string"
 +
    },
 +
    "sections_title": {
 +
      "label": "Sidebar title",
 +
      "type": "string",
 +
      "default": "On this page"
 +
    },
 +
    "sections_content": {
 +
      "label": "Sidebar links",
 +
      "description": "Bulleted list using * and ** (no leading spaces).",
 +
      "type": "string",
 +
      "suggested": true
 +
    },
 +
    "about_title": {
 +
      "label": "About: title",
 +
      "type": "string",
 +
      "default": "About"
 +
    },
 +
    "about_content": {
 +
      "label": "About: content",
 +
      "type": "content"
 +
    },
 +
    "featured_title": {
 +
      "label": "Featured: title",
 +
      "type": "string",
 +
      "default": "Featured"
 +
    },
 +
    "featured_content": {
 +
      "label": "Main content",
 +
      "description": "The page body (headings, paragraphs, lists).",
 +
      "type": "content",
 +
      "suggested": true
 +
    },
 +
    "news_title": {
 +
      "label": "News: title",
 +
      "type": "string",
 +
      "default": "News"
 +
    },
 +
    "news_content": {
 +
      "label": "News: content",
 +
      "type": "content"
 +
    },
 +
    "image_content": {
 +
      "label": "Right column content",
 +
      "description": "Optional image/thumb or extra block.",
 +
      "type": "content"
 +
    },
 +
    "layout": {
 +
      "label": "Layout",
 +
      "description": "auto = 3-column flex; stack = vertical.",
 +
      "type": "string",
 +
      "default": "auto",
 +
      "example": "auto|stack"
 +
    },
 +
    "two_col": {
 +
      "label": "Force two columns",
 +
      "description": "yes = hide right column even if image_content is set.",
 +
      "type": "string",
 +
      "default": "no",
 +
      "example": "yes|no"
 +
    },
 +
    "left_width": {
 +
      "label": "Left column width",
 +
      "type": "string",
 +
      "default": "320px"
 +
    },
 +
    "aside_width": {
 +
      "label": "Right column width",
 +
      "type": "string",
 +
      "default": "320px"
 +
    },
 +
    "gap": {
 +
      "label": "Column gap",
 +
      "type": "string",
 +
      "default": "1rem"
 +
    },
 +
    "pullup": {
 +
      "label": "Top gap compensation",
 +
      "description": "Adjust if you still see a white strip under the header.",
 +
      "type": "string",
 +
      "default": "0.8em"
 +
    },
 +
    "show_toc": {
 +
      "label": "Show Table of Contents",
 +
      "type": "string",
 +
      "default": "no",
 +
      "example": "yes|no"
 +
    },
 +
    "show_section_edit": {
 +
      "label": "Show section edit links",
 +
      "type": "string",
 +
      "default": "no",
 +
      "example": "yes|no"
 +
    }
 +
  }
 +
}
 +
</templatedata>
  
 
<noinclude>[[Category:Templates]]</noinclude>
 
<noinclude>[[Category:Templates]]</noinclude>

Revision as of 09:53, 18 September 2025





Modern inline, 2–3 column content layout for Holdfast wiki (no site CSS required).

Template parameters

ParameterDescriptionTypeStatus
Welcome headlinewelcome

Big page header text

Stringsuggested
Blurbblurb

Tagline under the header

Stringoptional
Sidebar titlesections_title

no description

Default
On this page
Stringoptional
Sidebar linkssections_content

Bulleted list using * and ** (no leading spaces).

Stringsuggested
About: titleabout_title

no description

Default
About
Stringoptional
About: contentabout_content

no description

Contentoptional
Featured: titlefeatured_title

no description

Default
Featured
Stringoptional
Main contentfeatured_content

The page body (headings, paragraphs, lists).

Contentsuggested
News: titlenews_title

no description

Default
News
Stringoptional
News: contentnews_content

no description

Contentoptional
Right column contentimage_content

Optional image/thumb or extra block.

Contentoptional
Layoutlayout

auto = 3-column flex; stack = vertical.

Default
auto
Example
auto|stack
Stringoptional
Force two columnstwo_col

yes = hide right column even if image_content is set.

Default
no
Example
yes|no
Stringoptional
Left column widthleft_width

no description

Default
320px
Stringoptional
Right column widthaside_width

no description

Default
320px
Stringoptional
Column gapgap

no description

Default
1rem
Stringoptional
Top gap compensationpullup

Adjust if you still see a white strip under the header.

Default
0.8em
Stringoptional
Show Table of Contentsshow_toc

no description

Default
no
Example
yes|no
Stringoptional
Show section edit linksshow_section_edit

no description

Default
no
Example
yes|no
Stringoptional

Navigation menu