Skip to main

Taxonomy Filters

src/filters/taxonomy.js


general

fromTaxonomy()

Access the taxonomy directly. This can also be done in nunjucks, using the taxonomy global variable, but a filter makes that available from inside macros, without passing it in as an argument.

Params:

  • type {oss | post}

    Any taxonomy defined in the taxonomy.yaml data file

  • find {any} = undefined

    Optionally return an object in the taxonomy, using lodash _.find()

  • get {string} = undefined

    Optionally return a single attribute of the found object

open-source

ossGroups()

Group a collection of open-source project-pages based on the type of OSS contribution made. Groups are defined in the taxonomy.yaml data file.

Params:

  • collection {array}

    containing 11ty page objects

  • only {string} = undefined

    Optionally return a single group, based on the group title

resources

pageType()

Return one of several resource “types” which we can use to provide different list styling or filtering. Types are defined in the taxonomy.yaml data file.

Params:

  • tags {array}
  • get {false | 'tag' | 'byline' | 'icon'} = undefined

    False will return the entire taxonomy of the type


See Also: