Closed ClintH closed 2 years ago
Does it works this way in MDX? I personally wouldn't expect this syntax to work.
The following should work with an explicit img
tag, though.
---
notworking: working
---
<img src={frontmatter.notworking} alt="foo" />
I suppose I expected variables to work consistently as per the variables in Markdown documentation.
One might argue that the syntax is the MD equivalent for the IMG
tag example you give. Having to use HTML or fancy components would be a shame as it diminishes the point of using Markdown.
Could someone from Astro please explain how frontmatter variables are supposed to work?
None of the examples render the variable value for me in the output:
A link - [{frontmatter.url}]({frontmatter.url})
In backquotes - `{frontmatter.technology}`
In codeblocks -
'''
git clone {frontmatter.url}.git
cd fusionauth-quickstart-wordpress-web
'''
What syntax do I use to get these to render? Otherwise I have to copy and paste their values dozens of times throughout my document, and update every one manually whenever I change them.
This doesn't render:
<a href="{frontmatter.url}">{frontmatter.url}</a>
But this does:
<a href={frontmatter.url}>{frontmatter.url}</a>
In case others find this thread as I did - my mistake was using .md
files and not .mdx
files.
With .mdx files and the MDX extension installed I can now use frontmatter variables directly in the markdown using {frontmatter.variable_name}
.
What version of
astro
are you using?1.0.0-beta.27
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
Seems the same issue as #2886 ?
Yields HTML:
Expected HTML:
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-9qfe1m-wef4od?file=src%2Fpages%2Findex.md,package.json
Participation