You can assign metadata to all the pages in a collection by adding it to the
config.yml file like so.
articles collection has metadata with the names of
output. The metadata
output has a special purpose to render a page for each document in your collection.
To access the metadata of a collection you'll need to extract it from the site collection data like so.
And then use it like this.
Also you can add Front Matter defaults to
config.yml to save having to repeat the same setting on every page.
So here, for all pages in the
articles collection, the
layout is set to
post and is not required in the Front Matter of those pages.