Skip to content
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

Should cobalt use the native yml date/time format #349

Closed
epage opened this issue Dec 27, 2017 · 8 comments
Closed

Should cobalt use the native yml date/time format #349

epage opened this issue Dec 27, 2017 · 8 comments

Comments

@epage
Copy link
Member

epage commented Dec 27, 2017

See the spec.

It looks like Jekyll advertises a specific flavor.

@epage epage added breaking-change question Uncertainty is involved labels Dec 27, 2017
@epage
Copy link
Member Author

epage commented Dec 28, 2017

While frontmatter is yml.,

  • _data can also be toml (similar but probably not same as yml) or json (no time format)
  • We also need to consider what format is "native" to liquid.

@epage
Copy link
Member Author

epage commented Dec 28, 2017

RE Liquid

The main use case I find is the date filter

@epage
Copy link
Member Author

epage commented Dec 28, 2017

The commit that cobalt's format was introduced in doesn't provide much reasoning

8bd0722

@epage
Copy link
Member Author

epage commented Dec 28, 2017

So summary of my thoughts

  • Use a format that is cross-format (ie not yml specific)
  • We should make the time portion optional, like Jekyll
  • Main contenders would be the current format (28 December 2017 15:45:10 +0800) or Jekyll's (2017-12-28 15:45:10 +0800).

@epage
Copy link
Member Author

epage commented Dec 29, 2017

irb(main):003:0> Time.parse("05 December 2017 15:23:00 +0800")
=> 2017-12-05 15:23:00 +0800

Looks like Time.parse supports our format, therefore the date filter should support it, therefore we know it doesn't conflict with other potential date formats to parse in Ruby's complex parse function, therefore the existing format is future compatible.

@Geobert
Copy link
Contributor

Geobert commented Dec 29, 2017

Let's support them all? give some flexibility to the user.

If optional, when sorting by order, do we put them at the beginning or the end (atm, we fallback to beginning of time)

I like the Jekyll's format best, I don't like having the month fully written ^^'

@epage
Copy link
Member Author

epage commented Dec 29, 2017

The date filter should support a variety of inputs because the source of the data can be a lot of different things (and because the official version of liquid does it).

I don't see much value in supporting multiple formats in the frontmatter. This is data written by the user specifically for cobalt. We'd need to document the choices which adds noise to the documentation. I've been working to make cobalt opinionated in things that people should have no reason to change (like names of the _ prefixed directories) while keeping it flexible for a lot of other things.

@Geobert
Copy link
Contributor

Geobert commented Dec 29, 2017

I see, I didn't think of the documentation aspect, you're totally right :)

@epage epage removed the question Uncertainty is involved label Dec 29, 2017
epage added a commit to epage/cobalt.rs that referenced this issue Dec 29, 2017
epage added a commit to epage/cobalt.rs that referenced this issue Dec 30, 2017
Fixes cobalt-org#349

BREAKING CHANGE:

Frontmatter `published_date` switched from "29 December 2016 15:20:21
-0700" to "2016-12-29 15:20:21 -0700".

`cobalt migrate` should handle this for you.
epage added a commit to epage/cobalt.rs that referenced this issue Dec 30, 2017
Fixes cobalt-org#349

BREAKING CHANGE:

Frontmatter `published_date` switched from "29 December 2016 15:20:21
-0700" to "2016-12-29 15:20:21 -0700".

`cobalt migrate` should handle this for you.
@epage epage added this to the 0.10.0 milestone Dec 30, 2017
@epage epage closed this as completed in 1e19ae0 Jan 6, 2018
epage added a commit that referenced this issue Jan 9, 2018
This release focused on unleashing a lot of breaking changes that have been
stacking up for a while which also expose a lot of features that have been
inaccessible.  The hope is that from now on, breaking changes will be minor
(like small changes to config) rather than sweeping changes to every file like
this.

Bug Fixes

*   Reducing logging noise ([a7acd2c](a7acd2c))
* **rss:**  Don't error if the RSS folder doesn't exist. ([357cb4b](357cb4b))
* **watch:**  Don't stop on error ([3c4d086](3c4d086), closes [#347](#347))

Features

*   Migrate support for changing _layouts to _includes ([28ae870](28ae870))
* **config:**
  *  Change .cobalt.yml to _cobalt.yml ([c4ee83b](c4ee83b), closes [#348](#348))
  *  Stablize the format ([34e9d54](34e9d54), closes [#199](#199), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/), [#](https://github.com/cobalt-org/cobalt.rs/issues/))
* **front:**
  *  Stablize fronmatter format ([9089c72](9089c72), closes [#257](#257), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Change date to YYYY-MM-DD ([1e19ae0](1e19ae0), closes [#349](#349), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Change permalink variable names ([e78b806](e78b806), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Change permalink to well-defined format ([c6c4d7a](c6c4d7a), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Standardize permalink behavior ([6730eb6](6730eb6), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
* **excerpt:**  Better define non-existent behavior ([129c574](129c574))
* **page:**
  *  Upgrade liquid ([2ec3f24](2ec3f24))
  *  Generalize is_post / posts ([d280a35](d280a35), closes [#323](#323), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Make page variables future-proof ([6f62dea](6f62dea), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  page.file.parent variable ([dce1d59](dce1d59), closes [#338](#338))
* **serve:**
  *  Adjust base_url for localhost ([e75e139](e75e139), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Merge `serve` and `watch` ([d2f22d5](d2f22d5), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
* **debug:**
  *  Report asset files ([5d77b7f](5d77b7f))
  *  Generalize debug commands ([087d991](087d991), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))

Breaking Changes

`cobalt migrate` was created to help mitigate the cost of most of these breaking changes.

* **config:**  Stablize the format ([34e9d54](34e9d54), closes [#199](#199), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/), [#](https://github.com/cobalt-org/cobalt.rs/issues/))
* **debug:**  Generalize debug commands ([087d991](087d991), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
* **front:**
  *  Change date to YYYY-MM-DD ([1e19ae0](1e19ae0), closes [#349](#349), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Change permalink variable names ([e78b806](e78b806), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Change permalink to well-defined format ([c6c4d7a](c6c4d7a), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Standardize permalink behavior ([6730eb6](6730eb6), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Stablize fronmatter format ([9089c72](9089c72), closes [#257](#257), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
* **page:**
  *  Liquid errors on undefined variables ([2ec3f24](2ec3f24))
    * This was done to help catch migration problems and to move us in the direction of easier debugging of problems
    * The restriction might be loosened in some cases (like `{% if var %}`).
  *  Generalize is_post / posts ([d280a35](d280a35), closes [#323](#323), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Make page variables future-proof ([6f62dea](6f62dea), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
* **serve:**
  *  Adjust base_url for localhost ([e75e139](e75e139), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))
  *  Merge `serve` and `watch` ([d2f22d5](d2f22d5), breaks [#](https://github.com/cobalt-org/cobalt.rs/issues/))

Performance

* **serve:**  Reduce duplicate rebuilds ([8f2679c](8f2679c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants