#Blank line beween YAML frontmatter and import statements

2 messages · Page 1 of 1 (latest)

thick wraithBOT
#

Hi @dull trellis. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Astro’s docs show imports written immediately after the closing frontmatter fence (---), with no blank line required. For example, MDX after conversion:

---layout: '../../layouts/BaseLayout.astro'
title: 'Migrating to MDX'
date: 2022-07-26
tags: ["markdown", "mdx", "astro"]
---
import ReactCounter from '../../components/ReactCounter.jsx'

[Convert to MDX]

Astro also only requires that imports appear at the top of the component script; it does not mention any need for a blank line. [Imports on top]

So, you do not need a blank line between frontmatter and import statements. You may add one for readability; the docs do not state any restriction either way.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: