#hi can i use html files along with markdown files for my content collection?i got few html files rn
9 messages · Page 1 of 1 (latest)
Hi @vernal cradle. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
You can mix Markdown and other data formats in a single (non-legacy) content collection, but the docs only list these as supported entry file types: Markdown, MDX, Markdoc, YAML, TOML, JSON when using the glob() loader. [Content collections; Defining loader]
There is no mention of .html files being supported as collection entries in the content collections docs, and the only documented uses of .html are:
- As pages in
src/pages/[HTML pages] - As HTML components (importable
.htmlfiles) [HTML components]
Because .html is not listed as a supported collection entry type, I can’t confidently say you can put .html files directly into a content collection alongside Markdown. The knowledge sources don’t describe such a setup.
What you can do with the information we have:
- Keep your existing
.htmlfiles as HTML pages/components insrc/pages/or as imported components. [HTML components; HTML pages] - Start a content collection for new content using Markdown/MDX/etc. and grow it over time. [Content collections]
If you specifically need those existing HTML files to be entries in a content collection, the docs provided here don’t show a supported way to do that without converting them to one of the supported formats.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@vernal cradle Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Let me check the knowledge base for you again. One moment! :books:
Yes, you can use (some) HTML in .md files, but behavior depends on what you’re doing:
-
Standard Markdown in Astro: You can include HTML elements directly in Markdown pages/content, e.g.
<p>HTML elements</p>alongside Markdown. [Individual pages] -
Images exception: For local images in
src/, you must use Markdown syntax![]();<img>is only supported forpublic/or remote images. [Images in Markdown] -
Markdoc integration: If you’re using
@astrojs/markdoc, HTML is not recognized by default. You must enable it withallowHTML: truein the Markdoc integration config to mix HTML with Markdoc content. [Markdoc allowHTML]