diff options
author | 2023-01-24 08:38:06 -0800 | |
---|---|---|
committer | 2023-01-24 11:38:06 -0500 | |
commit | 73ca0ef38352896f7c8fdaae23f881d02e60a180 (patch) | |
tree | 0e0efa55fc1e49b7e5ad2ca100ff93803344cc3e /.changeset/beige-pumpkins-pump.md | |
parent | 58dfdc5a364e4ba46538466af8666e70af21987f (diff) | |
download | astro-@astrojs/vercel@3.0.0.tar.gz astro-@astrojs/vercel@3.0.0.tar.zst astro-@astrojs/vercel@3.0.0.zip |
[ci] release (#5948)create-astro@2.0.0astro@2.0.0@astrojs/webapi@2.0.0@astrojs/vue@2.0.0@astrojs/vercel@3.0.0@astrojs/telemetry@2.0.0@astrojs/tailwind@3.0.0@astrojs/svelte@2.0.0@astrojs/solid-js@2.0.0@astrojs/rss@2.1.0@astrojs/react@2.0.0@astrojs/prism@2.0.0@astrojs/preact@2.0.0@astrojs/partytown@1.0.3@astrojs/node@5.0.0@astrojs/netlify@2.0.0@astrojs/mdx@0.15.0@astrojs/markdown-remark@2.0.0@astrojs/lit@1.1.0@astrojs/image@0.13.0@astrojs/deno@4.0.0@astrojs/cloudflare@6.0.0
* [ci] release
* Update changelogs (#5955)
* [ci] release
* Wrap astro 2.0 beta logs in `<details>`
* Add link to docs upgrade guide
* First pass cleaning up 2.0 release notes
* mdx changes from Sarah
* combine 5584 and 5842 in deno, image, netlify
* markdown/remark incl (5684 & 5769) to match mdx
* Tweak markdown/remark formatting
* Format astro-prism
* Format astro-rss
* Format create-astro
* Format cloudflare
* Format lit
* Format partytown
* Format node
* Format preact
* Format react
* Format solid
* Format svelte
* Format tailwind
* Format vercel
* Format vue
* Format telemetry
* Format webapi
* Format scripts
* Reinstate h3s for headings
Co-authored-by: Ben Holmes <hey@bholmes.dev>
* Reformat mdx
* astro & markdown/remark: Combine #5679 & #5684 changelogs
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Ben Holmes <hey@bholmes.dev>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Ben Holmes <hey@bholmes.dev>
Diffstat (limited to '.changeset/beige-pumpkins-pump.md')
-rw-r--r-- | .changeset/beige-pumpkins-pump.md | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/.changeset/beige-pumpkins-pump.md b/.changeset/beige-pumpkins-pump.md deleted file mode 100644 index 54b33a619..000000000 --- a/.changeset/beige-pumpkins-pump.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -'astro': major -'@astrojs/markdown-remark': major -'@astrojs/mdx': minor ---- - -Give remark and rehype plugins access to user frontmatter via frontmatter injection. This means `data.astro.frontmatter` is now the _complete_ Markdown or MDX document's frontmatter, rather than an empty object. - -This allows plugin authors to modify existing frontmatter, or compute new properties based on other properties. For example, say you want to compute a full image URL based on an `imageSrc` slug in your document frontmatter: - -```ts -export function remarkInjectSocialImagePlugin() { - return function (tree, file) { - const { frontmatter } = file.data.astro; - frontmatter.socialImageSrc = new URL( - frontmatter.imageSrc, - 'https://my-blog.com/', - ).pathname; - } -} -``` - -#### Content Collections - new `remarkPluginFrontmatter` property - -We have changed _inject_ frontmatter to _modify_ frontmatter in our docs to improve discoverability. This is based on support forum feedback, where "injection" is rarely the term used. - -To reflect this, the `injectedFrontmatter` property has been renamed to `remarkPluginFrontmatter`. This should clarify this plugin is still separate from the `data` export Content Collections expose today. - - -#### Migration instructions - -Plugin authors should now **check for user frontmatter when applying defaults.** - -For example, say a remark plugin wants to apply a default `title` if none is present. Add a conditional to check if the property is present, and update if none exists: - -```diff -export function remarkInjectTitlePlugin() { - return function (tree, file) { - const { frontmatter } = file.data.astro; -+ if (!frontmatter.title) { - frontmatter.title = 'Default title'; -+ } - } -} -``` - -This differs from previous behavior, where a Markdown file's frontmatter would _always_ override frontmatter injected via remark or reype. |