Template

Difference between revisions of "Feed"

Line 1: Line 1:
<includeonly><div class="feed-block feed-mode-{{{mode|preview}}}">
<includeonly><div class="feed-block feed-mode-{{{mode|preview}}} feed-style-{{{style|overlay}}} {{#if:{{{cols|}}}|feed-cols-{{{cols}}}}} {{#if:{{{postbuttons|}}}|feed-postbuttons}} {{#if:{{{actions|}}}|feed-actions}}"><div class="feed-header"><h2 class="feed-title">{{#if:{{{viewall|}}}|[[{{{viewall}}}|{{{title}}}]]|{{{title}}}}}</h2>{{#ifeq:{{{feedctapos|top}}}|bottom||{{#if:{{{feedcta|}}}|<span class="feed-feedbtn">[{{{feedcta}}} {{#if:{{{feedctalabel|}}}|{{{feedctalabel}}}|View all}}]</span>}}}}</div><div class="feed-items">{{#if:{{{category|}}}|{{#dpl:category={{{category}}}
  <h2 class="feed-title">
|count={{{count|3}}}
    {{#if:{{{viewall|}}}|[[{{{viewall}}}|{{{title}}}]]|{{{title}}}}}
|order=descending
  </h2>
|ordermethod={{#ifeq:{{{sort|}}}|created|firstedit|lastedit}}
  <div class="feed-items{{#if:{{{cols|}}}| feed-grid}}"{{#if:{{{cols|}}}| style="--feed-cols:{{{cols}}}"}}>
|include={FeedData{{!}}FeedItem}
{{#dpl:
|format=,<div class="feed-item">,{{#if:{{{cta|}}}|<span class="feed-item-feedcard-btn">[{{{cta}}} {{#if:{{{ctalabel|}}}|{{{ctalabel}}}|Learn more}}]</span>}}</div>,
category          = {{{category|}}}
}}|{{#if:{{{namespace|}}}|{{#dpl:namespace={{{namespace}}}
namespace          = {{{namespace|}}}
|count={{{count|3}}}
notcategory        = {{{exclude|}}}
|order=descending
count             = {{{count|3}}}
|ordermethod={{#ifeq:{{{sort|}}}|created|firstedit|lastedit}}
order             = descending
|include={FeedData{{!}}FeedItem}
ordermethod       = lastedit
|format=,<div class="feed-item">,{{#if:{{{cta|}}}|<span class="feed-item-feedcard-btn">[{{{cta}}} {{#if:{{{ctalabel|}}}|{{{ctalabel}}}|Learn more}}]</span>}}</div>,
format            = ,{{FeedItem|page=%PAGE%|title=%TITLE%|image={{#var:feedimage}}|desc={{#var:feeddesc}}|style={{{style|overlay}}}|cta={{{cta|}}}|ctalabel={{{ctalabel|}}}|actions={{{actions|}}}\n}},,
}}|{{#dpl:namespace=Main
|count={{{count|3}}}
|order=descending
|ordermethod={{#ifeq:{{{sort|}}}|created|firstedit|lastedit}}
|include={FeedData{{!}}FeedItem}
|format=,<div class="feed-item">,{{#if:{{{cta|}}}|<span class="feed-item-feedcard-btn">[{{{cta}}} {{#if:{{{ctalabel|}}}|{{{ctalabel}}}|Learn more}}]</span>}}</div>,
}}}}}}</div>{{#ifeq:{{{feedctapos|top}}}|bottom|{{#if:{{{feedcta|}}}|<div class="feed-footer"><span class="feed-feedbtn">[{{{feedcta}}} {{#if:{{{feedctalabel|}}}|{{{feedctalabel}}}|View all}}]</span></div>}}}}</div></includeonly><noinclude>
'''Feed''' shows the newest pages as a row of cards. Type it on any page:
 
<pre>
{{Feed
|title=Latest Knitting Blog Posts
|category=Knitting
|count=3
|viewall=Feed:Knitting
}}
}}
  </div>
</pre>
</div></includeonly><noinclude>
'''Usage (unchanged parameters):'''
* title, category, namespace, exclude, count, mode, viewall — same as before.
 
'''New optional parameters:'''
* '''cols''' — number of columns on wide screens. Leave blank for the
  original default (3, via the existing flexible layout). Set to a
  number (e.g. <code>cols=2</code> or <code>cols=4</code>) to use a
  strict grid with that many columns instead.
* '''style''' — visual style of each card:
** (blank / not set) — original look: title overlaid on the photo,
  description below it. Unchanged from before.
** <code>overlaytop</code> — title across the TOP of the photo,
  description across the BOTTOM of the photo (both over the image).
** <code>side</code> — photo alone on the left, title and description
  stacked on the right, nothing written over the image. Intended for
  one-column "view all" style pages.
* '''cta''' — a URL. If set, adds a small button to every card in this
  feed. Combine with '''ctalabel''' for the button's text (default:
  "Learn more").
* '''actions''' — set to <code>1</code> to add placeholder like/share
  icon buttons to every card in this feed. (These are visual only —
  no click behavior is wired up yet, since the action wasn't defined.)


'''Examples:'''
'''Which pages:''' <code>category</code> (one category name) or <code>namespace</code>. If neither is given, the feed shows the newest pages in the main (article) namespace. <code>count</code> = how many cards. <code>sort=created</code> = newest ''created'' first (the default is most recently ''edited'').
<pre>
{{Feed|title=Latest Camping Blog Posts|category=Camping|count=3|mode=preview|viewall=Feed:Camping}}
    -> exactly like before, 3 across, title-over-image style


{{Feed|title=Latest Camping Blog Posts|category=Camping|count=3|cols=4}}
'''Look:''' <code>style</code> = (leave blank), <code>overlaytop</code> or <code>side</code>. <code>cols</code> = 1 to 5 columns (default 3). <code>actions=1</code> = show like/share icons. <code>mode</code> = preview or full. <code>viewall</code> = the page the title links to.
    -> same style, but 4 across instead of 3


{{Feed|title=Latest Camping Blog Posts|category=Camping|count=50|mode=full|style=side}}
'''Buttons (all optional, any combination):'''
    -> "view all" page, one per row, photo left / text right
* <code>postbuttons=1</code> – each card shows its OWN button, taken from <code>cta</code> and <code>ctalabel</code> in that post's <code><nowiki>{{FeedData}}</nowiki></code> line.
* <code>cta</code> and <code>ctalabel</code> – ONE button repeated on every card (same link and text on all). The label cannot contain a comma.
* <code>feedcta</code> and <code>feedctalabel</code> – ONE button for the whole feed, beside the title. Add <code>feedctapos=bottom</code> to put it under the cards instead.


{{Feed|title=Latest Camping Blog Posts|category=Camping|count=3|style=overlaytop|cta=https://example.com/book|ctalabel=Book Now|actions=1}}
Every web address must be complete, starting with <code>https://</code>.
    -> title-top/desc-bottom over the photo, plus a "Book Now" button
      and like/share icons on every card
</pre>
</noinclude>
</noinclude>

Revision as of 01:04, 14 October 2026

Feed shows the newest pages as a row of cards. Type it on any page:

{{Feed
|title=Latest Knitting Blog Posts
|category=Knitting
|count=3
|viewall=Feed:Knitting
}}

Which pages: category (one category name) or namespace. If neither is given, the feed shows the newest pages in the main (article) namespace. count = how many cards. sort=created = newest created first (the default is most recently edited).

Look: style = (leave blank), overlaytop or side. cols = 1 to 5 columns (default 3). actions=1 = show like/share icons. mode = preview or full. viewall = the page the title links to.

Buttons (all optional, any combination):

  • postbuttons=1 – each card shows its OWN button, taken from cta and ctalabel in that post's {{FeedData}} line.
  • cta and ctalabel – ONE button repeated on every card (same link and text on all). The label cannot contain a comma.
  • feedcta and feedctalabel – ONE button for the whole feed, beside the title. Add feedctapos=bottom to put it under the cards instead.

Every web address must be complete, starting with https://.