New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collections for defining a new type of content #43

Closed
yosymfony opened this Issue Jul 27, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@yosymfony
Copy link
Member

yosymfony commented Jul 27, 2015

Prior to Spress 2, the only available types of content were post and page. With the second mayor version of Spress we introduce collections. Collections allow you to define a new type of content that behave like pages or posts.

Predefined collections: post and pages. First collection for items located at src/content/posts.

How to configure

Add the following to your config.yml:

collections:
  post:
    output: true

  projects:
    output: true
    title: "A project of my company"

The prior example adds a new collections called projects. Next add a new folder with the same name at your content folder: my-site/src/content/projects. The items located at the project folder belong to projects collection.

Attributes with special meaning:

output: true for writing the rendered content to the output system, normally a file.

Default attributes

Default attributes can be set for a collection. e.g: title. Item's attributes overrides the collection's default attributes.

How to access?

Items of a project collections are available at site.projects. Each item has an attribute collection with the name of the collection.

Data about collections available at site.collections.projects. Attributes available:

  • output
  • path: the relative path to the collection source.
  • default values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment