Collection Block

Table of Contents

Usage

Sportchemy defines a new block called sportchemy-collection. This block is inspired by the Wowchemy Page Collection, but it adds some additional parameters specific for the match archetype.

---
title: My page
type: landing

sections:
  - block: sportchemy-collection
    id:
    content:
      title:
      subtitle:
      text:
      text_below:
      # Choose how many matches you would like to display (0 = all pages)
      count: 6
      # Filter on criteria
      filters:
        # The folders to display content from
        team:
          -
        season:
          -
        league:
          -
        tournament:
          -
        category:
        tag:
        featured_only: false
        exclude_featured: false
        exclude_future: false
        exclude_past: false
        # you can also filter using a date range from "from" to "to"
        from:
        to:
      # Choose how many pages you would like to offset by
      # Useful if you wish to show the first item in the Featured widget
      offset: 0
      # Field to sort by, such as Date
      sort_by: 'Date'
      sort_ascending: false
      archive:
        enable: true
    design:
      # Choose a listing view from:
      # sportchemy-card-view, sportchemy-table-view
      view: sportchemy-card-view
      view_params:
        # common parameters
        date_format:
        time_format:
        # additional parameters are specific to each view
        # ...
      # Choose single or dual column layout
      columns: '1'

Parameters

sportchemy-collection supports the general parameters of every Wowchemy block, with the possibility to also add a text below the matches using the text_below key. In addition, it defines some additional parameters specific for match.

Filters

Additional parameters are added to filter games:

  • team: List of teams to display (both home and away games). If empty, all teams are included.
  • season: List of seasons to include in the block. If empty, all seasons are included.
  • league: List of leagues to include in the block. If empty, all leagues are included.
  • category, tags: List of categories and tags to include, to be aligned with Wowchemy collection.
  • featured_only: set to true to include only featured games.
  • exclude_featured: set to true to display only non-featured games
  • exclude_future: set to true to display only past games
  • exclude_past: set to true to display only future games
  • from: set to a date to only show matches from that date
  • to: set to a date to only show matches until that date

Views

Sportchemy defines two views for its Collection block.
Some customizations can be specified using the degign/view_params parameter. See the description of each view to see which options are available.

Card View

The sportchemy-card-view layout displays games using Bootstrap cards:

Cards are arranged in 3, 2 or 1 columns, depending on the screen size.

Card View Parameters

  • date_format : default Mon, 2 Jan 2006
  • time_format : default 15:05
    Date and time are defined using Hugo constants.

Table View

The sportchemy-table-view layout displays games using a Table:

Table View Parameters

  • date_format : default Mon, 2 Jan 2006
  • time_format : default 15:05
    Date and time are defined using Hugo constants.
  • show_league : default false
    If true, add a column which shows the league of each match. Can be useful in case of multiple leagues in the same table.

View Hooks

Differently from Wowchemy, Sportchemy views are called inside a hook function: