Hello! My blog uses Katex, so the titles need MDX support. Is there a way to render just the title/description of content seperately, at build time? I know https://docs.astro.build/en/guides/markdown-content/#fetching-remote-markdown says you can't do this when performing SSR, but it should be possible at build time?
#render title of content as inline MDX at build time
6 messages · Page 1 of 1 (latest)
@rustic oracle
I'm not familiar with Katex. But from the example at the link you shared, you could do the same:
---
// Example: Fetch Markdown from a remote API
// and render it to HTML, at runtime.
// Using "marked" (https://github.com/markedjs/marked)
import { marked } from 'marked';
const response = await fetch("from Katex");
const title = await response.text();
const title= marked.parse(title);
---
<h1 set:html={title} />
i'd like to reuse all my mdx stuff if possible. i basically just want inline mdx rendering on arbitrary strings at build time, surely that's possible, right?
I get why it wouldn't be possible for SSR (you'd need mdx infrastructure which is only accessible at build time), but it sounds like it should be 100% doable at build time
i'd rather not maintain two different katex plugins for the content of the post and the titles/descriptions