Difference between revisions of "Template:ContentTemplateModernInline"
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}}};"> |
| − | |||
<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}}};"> |
| − | |||
<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
Sections
Modern inline, 2–3 column content layout for Holdfast wiki (no site CSS required).
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Welcome headline | welcome | Big page header text | String | suggested |
| Blurb | blurb | Tagline under the header | String | optional |
| Sidebar title | sections_title | no description
| String | optional |
| Sidebar links | sections_content | Bulleted list using * and ** (no leading spaces). | String | suggested |
| About: title | about_title | no description
| String | optional |
| About: content | about_content | no description | Content | optional |
| Featured: title | featured_title | no description
| String | optional |
| Main content | featured_content | The page body (headings, paragraphs, lists). | Content | suggested |
| News: title | news_title | no description
| String | optional |
| News: content | news_content | no description | Content | optional |
| Right column content | image_content | Optional image/thumb or extra block. | Content | optional |
| Layout | layout | auto = 3-column flex; stack = vertical.
| String | optional |
| Force two columns | two_col | yes = hide right column even if image_content is set.
| String | optional |
| Left column width | left_width | no description
| String | optional |
| Right column width | aside_width | no description
| String | optional |
| Column gap | gap | no description
| String | optional |
| Top gap compensation | pullup | Adjust if you still see a white strip under the header.
| String | optional |
| Show Table of Contents | show_toc | no description
| String | optional |
| Show section edit links | show_section_edit | no description
| String | optional |