Skip to content

Generating a post tag based on the post date #316

Description

@danurbanowicz

I am happily using zero-maintenance tag pages but now I'm trying to additionally sort and paginate my posts (calendar events) based on an explicitly set date - and specifically by the month.

For example: I could just add tags: april to the post front matter, and it'd allow me to sort my posts by the april tag, but I was thinking it'd be better if Eleventy could just generate the tag from the post date filter I'm using. Something like:

tags: {{ event.date | monthName }} which would output tags: april

..but alas, we can't use template syntax in front matter data for anything other than the permalink field.

So, how could I generate a tag or array of tags for a post based on post data, such as the date? Or is anyone using a different method to organise their collections by date? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    educationwaiting-to-closeIssue that is probably resolved, waiting on OP confirmation.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions