Collections

All sections and taxonomies.

Info

Collections are automatically added based on Hugolify modules added (Sections) or (Taxonomies)

Enable or disable collections

/config/_default/params.yaml

admin:
  collections:
    indexes:
      enable: true
    pages:
      enable: true
    # e.g. set to false to disable posts even if you load hugolify-theme-posts
    posts:
      enable: false
    # …

Enable or disable file creation

/config/_default/params.yaml

admin:
  collections:
    pages:
      create: false

Override fields avalaible for a collection

/config/_default/params.yaml

admin:
  collections:
    pages:
      fields:
        - draft
        - title_page
        - description
        - featured_image
        - body

Add filter

/config/_default/params.yaml

admin:
  collections:
    pages:
      filter:
        - field: isPage
          value: true

Add path

/config/_default/params.yaml

admin:
  collections:
    pages:
      path: "{{slug}}"

Add slug

/config/_default/params.yaml

admin:
  collections:
    pages:
      slug: "{{id}}"

Add sortable

/config/_default/params.yaml

admin:
  collections:
    pages:
      sortable: "['title']"

Add summary

/config/_default/params.yaml

admin:
  collections:
    pages:
      summary: "{{title}}"

Add view filters

/config/_default/params.yaml

admin:
  collections:
    pages:
      view_filters:
        - label: 'Posts published in 2020'
          field: date
          pattern: '2020'

Add view groups

/config/_default/params.yaml

admin:
  collections:
    pages:
      view_groups:
        - label: 'Draft'
          field: draft

Add reorder

New in v2 Only available with Sveltia CMS

/config/_default/params.yaml

admin:
  collections:
    pages:
      reorder: true

Collection icon

New in v2

An icon is declared per icon set, so the same collection works whichever set the CMS uses. See Setup.

/config/_default/params.yaml

admin:
  collections:
    pages:
      icon:
        bootstrap_icons: file-earmark
        iconoir: page
        lucide: file
        material_icons: description
        material_symbols: description

Nested collections

New in v2

A collection can show its entries as a folder tree and let editors organise them in subfolders. Entries are stored as Hugo branch bundles — an _index file in a folder of its own — so a page can carry children and page resources.

Set the depth globally, or per collection when only one of them is a tree:

/config/_default/params.yaml

admin:
  nested:
    depth: 2 # every collection
  collections:
    docs:
      nested:
        depth: 4 # this one alone, overriding the global

The depth counts path segments below the collection folder, and is what limits how deep an editor may go.

DepthResult
1Nothing emitted — a flat collection
2Folder tree, one level of children
3 and upFolder tree, plus a parent field so an editor picks where a page goes and moves it later

Sveltia CMS

Nested collections used to be Decap-only. Sveltia CMS supports them now, and fixes several long-standing problems of the Decap implementation along the way — entry paths, preview paths, media folders, folder labels and i18n.

The parent field differs between the two: Decap gets a custom Hugolify widget, Sveltia its own folder picker. Hugolify writes the Decap widget and label either way, and Sveltia accepts both for compatibility and ignores them, so the same config serves the two.

The config collection

The config collection holds the site files an editor may change — menus, banner, footer, credit, SEO. Pick which ones it shows with files:

/config/_default/params.yaml

admin:
  collections:
    config:
      files: [nav-header-primary, nav-footer-primary, nav-legal, banner, footer, credit, blocks, seo]

Left undefined, the collection ships nav-header-primary, nav-header-secondary, nav-footer-primary, nav-footer-secondary, nav-legal, nav-social, banner, footer, credit and seo.

New in v2

Header and footer menus each gain three levels, replacing the single menu of v1. Add nav-header-tertiary and nav-footer-tertiary to files to reach the third one.

  • Header — primary, secondary, tertiary
  • Footer — primary, secondary, tertiary

The footer also accepts blocks, not just an information text.

Default appearance per block type

New in v2

Add blocks to files and the collection gains a file written to /data/blocks.yml, holding the default ui of each block type. It is the CMS-editable twin of params.blocks.<type>.ui: same shape, read on top of it key by key, so a field left empty falls back to the config instead of erasing it.

The form is generated from admin.blocks.enable, one collapsible section per block type, with the selected-* variants expanded per enabled collection exactly as the block picker expands them. A section arrives open when it already carries a value.

Unlike the rest of the config collection, this file is not translated: how a block looks is not language content.

See defaults per block

Create a collection

Use params to create a collection

/config/_default/params.yaml

admin:
  collections:
    new_collection:
      enable: true
      fields:
        - draft
        - title_page
        - description
        - featured_image
        - body

Or add a yml collection file

layouts/
└── partials/
    └── admin/
        └── collections/
            └── types/
See examples in repository