Skip to main

Post Macros

content/_includes/post.macros.njk

lists

by_year()

Group posts by year, when there are more than a set (above) number of posts

Params:

  • posts {array}

    containing 11ty page objects

  • collections {11ty collections object} = none
  • above {number} = 6
  • pagination {11ty pagination object} = none

recent_posts()

Returns a given number of recent posts from a collection

Params:

  • type {string}

    one of several post “types” to display (types are defined in the taxonomy.yaml data file)

  • collections {11ty collections object} = []
  • limit {number} = 3
  • banner_title {string} = Posts
  • page_url {url} = ''

list()

Generate a list of posts

Params:

  • posts {array}

    containing 11ty page objects

  • collections {11ty collections object} = none
  • title {string} = Posts
  • pagination {11ty pagination object} = none
  • override_feature {boolean} = false
  • override_large {boolean} = false
  • class {string} = none

    optional class added to wrapping <ol> element

homepage_posts()

Returns a given number of featured posts from a collection for the homepage “featured posts” section

Params:

  • collections {11ty collections object}
  • limit {number} = 4
  • banner_title {string} = Featured Posts
  • class {string} = none

    optional class added to wrapping <ol> element

posts

item()

Generate each post in a list

Params:

  • post {11ty page object}
  • collections {11ty collections object} = none
  • loop {Nunjucks `loop` object -- https://mozilla.github.io/nunjucks/templating.html#for} = none
  • override_feature {boolean} = false
  • override_large {boolean} = false

detail()

Content for posts in a list

Params:

  • post {11ty page object}
  • type {string} = none
  • collections {11ty collections object} = none

metadata

hero()

Display hero image for a post

Params:

  • image {object}
  • type {large | card | page} = large

byline()

Generate the post byline with type, authors, venue/client, date, location, and length if Winging It

Params:

  • post {11ty page object}
  • collections {11ty collections object} = none
  • links {boolean} = true

    Optionally remove links for content in linked cards

  • dateformat {false | string} = false

    Optionally show the date in a given format

subtitle()

Generate each post in a list

Params:

  • sub {markdown}
  • class {string} = none

by()

Show a linked list of authors

Params:

  • author {string | array}
  • collections {11ty collections object}

pubdate()

Generate a pubdate in the proper format

Params:

  • start {date}
  • end {date}
  • format {string} = long

client()

Show the client name on a client project

Params:

  • name {string}

where()

Show the address when available

Params:

  • adr {string}

linked()

Link to original post or venue

Params:

  • venue {string}
  • url {url}

taglist()

Show a linked list of all post tags, as pills

Params:

  • tags {array}
  • collections {11ty collections object}

pagination

page_current()

Show the current active page number & total page-count in a paginated list

Params:

  • pagination {11ty pagination object} = none
  • prefix {string | none} = none

    Prefix “x of y” with more context, e.g. “page x of y”

See Also