Collections

All content in Grow is stored as flat files in your pod's /content/ directory. Content is grouped into collections, and each collection contains a single blueprint and many documents. Blueprints describe the structure of all documents in the collection.

Grow makes it easy to separate content from presentation, but ultimately leaves the choice up to you. Content documents can be associated with URLs and with views (so they represent pages in your site), or not. Content documents without URLs are simply used internally, and can be referenced by other content documents.

Blueprints

Every content collection must have a blueprint. Blueprints define how content is structured, displayed, and served. Blueprints are stored as YAML files in your pod's content directory. For example, a blueprint for a collection "people" would be /content/people/_blueprint.yaml

path: /people/{slug}/              # The URL path format for content.
view: /views/people.html           # The template to use.

localization:                      # Overrides localization from podspec.yaml.
  path: /{locale}/people/{slug}/
  locales:
  - de
  - fr
  - it

path

Specifies the URL path format for all content in this collection. Documents inherit the path specified in the blueprint. If path is omitted, content in this collection will not be generated into pages, unless a document specifies its own $path. If path is specified, view is a required field. See a list of path formatters.url.path}}#content-document-path-formatters).

$path: /{root}/{base}/

view

Specifies which template should be used to render content in this collection. If view is specified, path is a required field.

# Documents in this collection will use the following template.
$view: /views/pages.html

localization

Localization configuration for content in this collection.

path

Specifies a URL path format for localized content. By specifying both path and localization:path, you can use different formats for the URL paths for "root" and localized content.

$localization:
  path: /{locale}/people/{slug}/

locales

Specifies a list of locales that documents in this collection are available in. Each document's path will be expanded using locales to derive the URLs that the document is available at.

$localization:
  locales:
  - de
  - fr
  - it

categories

The categories key contains a list of categories that documents inside the collection can fall into. A collection's categories can be used in conjunction with the g.categories template function to iterate over the documents in the collection, grouped by category.