List of pages

A list of pages from a folder, as links, cards or teasers.

When to use it

Lists that fill themselves from a folder of pages: the latest articles, the events, the pages of a section, pages with a tag, related pages. New pages appear without editing the list.

When not to

A few hand-picked links (use a nav, cards or teasers) and items that are not pages (use a collection with cards or table).

Accessibility

A list of links named by the pages' titles; dates are machine-readable. The filter variant adds a search box whose results are announced.

See it live

The component library shows this component in the default theme, in every variant: open it in the component library

The list of pages example as the component library shows it in the default theme

Where it is used

The starter sites that use it, each at a page that shows it:

Fields

What the component’s dialog asks for. In a Doc, keyed rows start with the key; rows in order follow the order below. One row, its cells in the order of the fields.

Field

Key

Kind

Required

Folder

folder

Plain text, one line

No

Order

sort

A value from a short list, or a setting

No

How many

limit

A value from a short list, or a setting

No

Only pages with this tag

tag

A value from a short list, or a setting

No

Only items of this content model

model

A value from a short list, or a setting

No

Keep only the items whose field or column has a value, as category = Mains or start >= today

filter

A value from a short list, or a setting

No

Variants

A variant changes how the component looks. Write it in parentheses after the name in the table’s first cell, several separated by commas.

Variant

Write in the first cell

As cards

list-pages (cards)

As teasers

list-pages (teasers)

With dates

list-pages (dates)

Related pages (same tags)

list-pages (related)

With tag filter

list-pages (filter)

In Google Docs

A component is a table. Its first cell names it; the rows below hold its fields. This is the example table:

list-pages

magazine

limit

3

In a page file

In a site kept as a folder or in Git, the same component is a block of the page’s JSON file:

JSON
{
  "name": "list-pages",
  "variants": [
    "cards"
  ],
  "rows": [
    [
      "magazine"
    ],
    [
      "limit",
      "3"
    ]
  ]
}

Markup and classes

What the component writes takes these classes, for a theme’s CSS: the component’s own name, name__part for its parts and name--variant for each variant (the variant’s plain name is there too).

Class

What it marks

list-pages

The component

list-pages__date

A part of it

list-pages__filter

A part of it

list-pages__filter-button

A part of it

list-pages__image

A part of it

list-pages__item

A part of it

list-pages__kicker

A part of it

list-pages__meta

A part of it

list-pages__status

A part of it

list-pages__summary

A part of it

list-pages__title

A part of it

list-pages--cards

A variant

list-pages--teasers

A variant

list-pages--dates

A variant

list-pages--related

A variant

list-pages--filter

A variant

The HTML the example above writes, as the component library builds it in the default theme:

html
<ul class="list-pages">
    <li><a href="/magazine/trip/">Another sample page</a> <span class="list-pages__summary">Every component in SeedPage: what it is for, how it looks and the table to write in a Doc.</span></li>
</ul>

Visitor texts

Texts it shows visitors, in the page’s language. Every one is in the visitor texts reference.

Key

Text

site.filter.label

Filter

site.filter.all

All

site.filter.results

one: {count} result; other: {count} results

Extending it

Its files in SeedPage. A theme or a site changes the markup by giving a file of the same name (the Liquid part), and a new component can extend this one.

  • src/components/list-pages.js
  • src/components/list-pages/list-pages.liquid
  • src/components/list-filter.client.js
  • src/components/list-dated.client.js

It has a browser script, the .client.js file above. Without it the component still shows all its content; the script only adds behaviour.