Method: Lifer::Entry#published_at

Defined in:
lib/lifer/entry.rb

#published_atTime

The entry’s publication date. The published date can be inferred in a few ways. The priority is:

1. the frontmatter's `published_at` field
2. the frontmatter's `published` field
3. the frontamtter's `date` field
4. The date in the filename.

Since text files would only store dates as simple strings, it’s nice to attempt to convert those into Ruby date or datetime objects.

Returns:

  • (Time)

    A Ruby representation of the date and time provided by the entry frontmatter or filename.



225
226
227
228
229
230
231
# File 'lib/lifer/entry.rb', line 225

def published_at
  date_for frontmatter[:published_at],
    frontmatter[:published],
    frontmatter[:date],
    filename_date,
    missing_metadata_translation_key: "entry.no_published_at_metadata"
end