Skip to content

Commit

Permalink
Tweaks to docs for 11ty/eleventy#142
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Feb 18, 2022
1 parent 5403f2b commit c3b30f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/docs/dates.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ date: Last Modified

Valid `date` values:

* `git Last Modified`: {% addedin "1.0.1" %} automatically resolves to the file’s latest git commit. If a file is not yet checked in to git, it assigns `Date.now()` to `page.date` instead.
* `Last Modified`: automatically resolves to the file’s last modified date
* `Created`: automatically resolves to the file’s created date (default, this is what is used when `date` is omitted).
* `git Last Modified`: {% addedin "1.0.1" %} automatically resolves to the file’s latest git commit. If a file is not yet checked in to git, it assigns `Date.now()` to `page.date` instead. This one is a bit resource intensive, so you may want to limit this to your CI server environment only using JavaScript data files and environment variables. Read more about [Environment Variables](/docs/data-js/#example-exposing-environment-variables) and check out [this example code](https://github.com/11ty/11ty-website/blob/5403f2b853e09165bec8bc6f7466a6a041487bcc/src/docs/docs.11tydata.js#L5-L7).
* `2016-01-01` or any other valid [YAML date value](https://yaml.org/type/timestamp.html) (leaving off the time assumes midnight in UTC, or `00:00:00Z`)
* `"2016-01-01"` or any other valid UTC **string** that [Luxon’s `DateTime.fromISO`](https://moment.github.io/luxon/#/parsing?id=iso-8601) can parse (see also the [Luxon API docs](https://moment.github.io/luxon/api-docs/index.html#datetimefromiso)).

Expand Down Expand Up @@ -90,8 +90,8 @@ You could add your own `toUTCString` [filter in Liquid](/docs/filters/) to perfo
This is a [**Common Pitfall**](/docs/pitfalls/).
{%- endcallout %}

Be careful relying on the default `date` associated with a piece of content. By default Eleventy uses file creation dates, which works fine if you run Eleventy locally but may reset in some conditions if you run Eleventy on a Continuous Integration server. Work around this by using explicit date assignments, either in your front matter or your content’s file name. [Read more at Content Dates](/docs/dates/).
Be careful relying on the default `date` associated with a piece of content. By default Eleventy uses file creation dates, which works fine if you run Eleventy locally but may reset in some conditions if you run Eleventy on a Continuous Integration server. Work around this by using explicit date assignments, either in your front matter or your content’s file name. Read more at [_Setting a Content Date in Front Matter_](#setting-a-content-date-in-front-matter).

{% callout "info", "md" -%}
{% addedin "1.0.1" %} The new `date: "git Last Modified"` feature will resolve this issue! Source control dates are available and will be consistent on most Continuous Integration servers.
{% addedin "1.0.1" %} The new `date: "git Last Modified"` feature will resolve this issue! Source control dates are available and will be consistent on most Continuous Integration servers. Read more at [_Setting a Content Date in Front Matter_](#setting-a-content-date-in-front-matter).
{%- endcallout %}

0 comments on commit c3b30f3

Please sign in to comment.