Skip to content

Add additionalFields as option with ($page)=>{} functions #2

@b0g3r

Description

@b0g3r

For example, we want to add color as a field to a tree.

In the old times, we would add color to a plugin source code: color: page.frontmatter.color || 'blue'. My proposal is to add an option additionalFields to plugin interface:

[
  '@b0g3r/generate-tree',
  {
    locales: LOCALES,
    additionalFields: {
      color: (page) => page.frontmatter.color || 'blue',
      title: (page) => page.frontmatter.title || page.title || '',
      ...
    }
  },
],

We should carefully check the ability to use these dynamic field names in the plugin type system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions