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

Markdown files without content miss custom frontmatter added via remark plugin #12800

Closed
1 task done
jelmerdemaat opened this issue Dec 20, 2024 · 2 comments · Fixed by #12920
Closed
1 task done

Markdown files without content miss custom frontmatter added via remark plugin #12800

jelmerdemaat opened this issue Dec 20, 2024 · 2 comments · Fixed by #12920
Labels
needs triage Issue needs to be triaged

Comments

@jelmerdemaat
Copy link

Astro Info

Astro                    v5.1.1
Node                     v22.12.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When using:

  1. a content collection,
  2. with markdown files,
  3. which contain frontmatter data, but no actual content besides frontmatter
  4. a custom remark plugin to add custom data

then the custom data is not present on the content entry when rendering it.

See the reproduction where the working example is a markdown file with content, and the broken example is a markdown file without content. Within the same content collection.

This has been discussed in Discord: https://discord.com/channels/830184174198718474/1318215008647122994

What's the expected result?

The expected result is to have the custom data that is added via the custom remark plugin available when rendering the content entry.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-58srtbao?file=src%2Fpages%2F%5Bslug%5D.astro

Participation

  • I am willing to submit a pull request for this issue.
@ooloth
Copy link

ooloth commented Jan 6, 2025

I'm experiencing this as well.

As another example, the last modified time remark example in the Astro docs works for files with body content, but does not work for files that only contain frontmatter.

@jelmerdemaat
Copy link
Author

Awesome. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants