Commit graph

4 commits

Author SHA1 Message Date
Ed Page
d280a35329 feat(liquid): Generalize is_post / posts
`page.collection` contains the collection slug which is `posts` for,
well, the built-in posts collection.

`collections.posts.pages` is a sorted list of all of the pages that are
part of the posts collection.

Fixes #323

BREAKING CHANGES:

`page.is_post` is replaced by `page.collection`.  Generally, it'll look like
`{% if page.is_post %}`
and can be replaced by
`{% if page.collection == "posts" %}`

`posts` is replaced by `collections.posts.pages`.  Generally, it'll look
like
`{% for post in posts %}`
and can be replaced by
`{% for post in collections.posts.pages %}`

`cobalt migrate` should do this for you.
2018-01-03 21:01:34 -07:00
Ed Page
6f62dea856 feat(liquid): Make page variables future-proof
This is a part of #257

Attributes from a page are now under the `page` object
- `path` -> `page.permalink` to make it clear this is the equivelant of `permalink` in the frontmatter
- `source` -> `page.file.permalink`
  - Under `file` to make room for `page.file.parent`
  - `permalink for consitency with `page.permalink`
- `date` -> `page.published_date`
  - Consistency with the new `published_date` in the front matter
  - Both are renamed to make it clear the role of the date (versus a future `modified_date` that might exist)
- `draft` -> `page.is_draft`
- `previous` -> `page.previous`
- `next` -> `page.next`
- Custom fields have moved from `<field>` to `page.data.<field>`.

BREAKING CHANGE: Liquid `{{ variables }}` have been renamed.

`cobalt migrate` will fix some.  `cobalt build` will most likely fail on
variables missed by `cobalt migrate`.
2018-01-03 21:01:34 -07:00
Ed Page
9089c721a2 feat(front): Stablize fronmatter format
The frontmatter is now a strictly defined format
- Custom data goes in the `data` field to avoid conflicts between user
  data and future cobalt data.
- `date` has been renamed to `published_date` to make it clear what role
  it plays and room for possibly adding a `modified_date`
- Error rather than ignore poorly formed fields
- `path` was a bit ambiguous.  The hope is that `permalink` will be more
  clear.

To help reduce noise when diffing an old site against a new site,
frontmatter fields that are default values are not written out to the
file.

Fixes #257

BREAKING CHANGES

frontmatter
- `date` renamed to `published_date` and will error on bad formatting
- `extends` renamted to `layout`
- `draft` renamed to `is_draft`
- `ext` now exposed as `format`
- `path` renamed to `permalink` and a leading `/` is needed unless a
  path alias is being used.

`cobalt migrate` has support to make these changes for you.
2018-01-03 21:01:34 -07:00
Uwe Arzt
291229bffb Posts in subdirs (#185) 2017-02-09 23:50:09 +01:00