Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting frontmatter from custom remarkPlugins #4581

Closed
1 task
RobbieTheWagner opened this issue Sep 1, 2022 · 2 comments
Closed
1 task

Getting frontmatter from custom remarkPlugins #4581

RobbieTheWagner opened this issue Sep 1, 2022 · 2 comments
Assignees
Labels
- P2: nice to have Not breaking anything but nice to have (priority)

Comments

@RobbieTheWagner
Copy link

What version of astro are you using?

1.0.1

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

It seems frontmatter is empty when defining remarkPlugins.

Setting arbitrary frontmatter is easy with remarkPlugins, but there seems to be no way to get existing frontmatter. For example, this will not work:

import authorData from './data/authors.mjs';

export function addAuthorRemarkPlugin() {
  return function (tree, post) {
    const author = authorData[post.data.astro.frontmatter.author];
    post.data.astro.frontmatter.author = author;
  }
}

Link to Minimal Reproducible Example

https://github.com/shipshapecode/website-astro

Participation

  • I am willing to submit a pull request for this issue.
@matthewp matthewp added the - P2: nice to have Not breaking anything but nice to have (priority) label Sep 1, 2022
@bholmesdev
Copy link
Contributor

Ah, third request I've seen for this! Definitely think this is worth implementing. Will make a PR soon 👍

@bholmesdev bholmesdev self-assigned this Sep 1, 2022
@bholmesdev
Copy link
Contributor

Marking as duplicate of this to track in one place #4429. Still on my todos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority)
Projects
None yet
Development

No branches or pull requests

3 participants