{
  "$type": "site.standard.document",
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreig6bnth6y5gapg4jq6g2gp5uoiquo77vcnomo3oupzydv6eykgmi4"
    },
    "mimeType": "image/png",
    "size": 184465
  },
  "path": "/notes/less-painful-editing-in-astro/",
  "publishedAt": "2026-06-14T00:00:00.000Z",
  "site": "at://did:plc:aes3lokiqtv63fk62nwnjeuf/site.standard.publication/3mnin5cnq2q2a",
  "textContent": "I write most of my content in Astro Editor, which is intentionally designed to leave all code-like things alone and just help me write prose. One of the most annoying things about this is that whenever I use a component like in an MDX file I have to remember to import it at the top of the file before I publish. I recently stumbled upon Chris Swithinbank's , which can automatically import named components into all astro files at build-time. After a bit of experimentation, I decided to import all the components in my MDX directory and added this to my ... This works like a charm. The only negative side-effect so far is that when running the dev server, all MDX-generated pages include the CSS and client-side JS for all these components whether they're used or not. This isn't an issue with production builds though, so I can live with that. Better editing outside content collections My notes and articles live in Content Collections but I also have a few text-based pages which don't – my Now page and my recently-added colophon, AI and Privacy pages. I was previously generating them from files in the same way I would for any other \"HTML Pages\": This is nice because I can still think of the page as a normal page and can fully control the HTML and CSS for it. The only reason the files exists is to make the content I change regularly nicer to edit. This is great for pages with their own design and layout, but all four of the pages I mentioned above essentially share the same layout and had almost identical 's. This is precisely what Astro's individual markdown support is for. And so now these pages are just MDX files: Here's what my now page looks like: To make this work I added a new layout specifically for this kind of page. The and are passed through to and the title is used for the Heading. If is present it's shown under the heading (and slightly changes some styling). does what it says on the tin. Thanks to , I can use all the same components in these files as I would in articles and notes without needing to import them. Broken component remapping I remap certain MDX components onto my own by passing this to Astro's so certain markdown elements are used in place of the defaults. The solution to this is pretty simple. I need to add this after the frontmatter in my pages: Considering the whole point of this is making it nicer to edit these pages, this felt all kinds of wrong. So I ended up with a tiny remark plugin which does it for me!",
  "title": "A less painful editing experience in Astro"
}