Files
.github
_data
_includes
_layouts
_sass
assets
docs
_data
_docs
01-quick-start-guide.md
02-structure.md
03-installation.md
04-upgrading.md
05-configuration.md
06-overriding-theme-defaults.md
07-navigation.md
08-ui-text.md
09-authors.md
10-layouts.md
11-posts.md
12-pages.md
13-collections.md
14-helpers.md
15-utility-classes.md
16-stylesheets.md
17-javascript.md
18-history.md
19-contributing.md
20-docs-2-2.md
21-license.md
_drafts
_includes
_layouts
_pages
_pets
_portfolio
_posts
_recipes
_sass
assets
Gemfile
_config.dev.yml
_config.yml
screenshot-layouts.png
screenshot.png
test
.editorconfig
.gitattributes
.gitignore
CHANGELOG.md
Gemfile
LICENSE.txt
README.md
Rakefile
_config.yml
index.html
minimal-mistakes-jekyll.gemspec
package.json
screenshot-layouts.png
screenshot.png
website/docs/_docs/13-collections.md
Michael Rose 57a4324fa0 Move gh-pages branch files into /docs and add test files
- Jekyll ignore `/docs` and `/test` folders when using from root
- Update Staticman config to point to correct branch and data file location
- Replace `{{ base_path }}` references with `absolute_url` filter
- Update documentation
2016-11-03 11:52:04 -04:00

1.8 KiB

title, permalink, excerpt, modified
title permalink excerpt modified
Working with Collections /docs/collections/ Suggestions and Front Matter defaults for working with collections. 2016-11-03T11:13:38-04:00

Collections like posts and pages work as you'd expect. If you're new to them be sure to read Jekyll's documentation.

The theme has been built with collections in mind and you will find [several examples]({{ "/collection-archive/" | absolute_url }}) on the demo site ([portfolio]({{ "/portfolio/" | absolute_url }}), [recipes]({{ "/recipes/" | absolute_url }}), pets).

Collections in the Wild: This set of documentation is also [built as a collection](https://github.com/{{ site.repository }}/blob/master/docs/_docs/) if you're looking for a fully fleshed out example to inspect. {: .notice--info}


A popular use case for collections is to build a portfolio section as part of one's personal site. Let's quickly walk through the steps to do that.

Step 1: Configure the portfolio collection by adding the following to _config.yml.

collections:
  portfolio:
    output: true
    permalink: /:collection/:path/

These settings essentially say output index.html files for each portfolio document in _portfolio at _site/portfolio/<document-filename>/.

Just like posts and pages you'll probably want to set some defaults for the Front Matter:

defaults:
  # _portfolio
  - scope:
      path: ""
      type: portfolio
    values:
      layout: single
      author_profile: false
      share: true

And then create portfolio content like [_portfolio/foo-bar-website.md](https://github.com/{{ site.repository }}/blob/master/docs/_portfolio/foo-bar-website.md), to end up with something like this.

![portfolio collection example]({{ "/assets/images/mm-portfolio-collection-example.jpg" | absolute_url }})