Skip to content

Add content-type to astro html#85

Merged
matthewp merged 1 commit into
mainfrom
jn.serve-html-content-type
Apr 13, 2021
Merged

Add content-type to astro html#85
matthewp merged 1 commit into
mainfrom
jn.serve-html-content-type

Conversation

@jonathantneal
Copy link
Copy Markdown
Contributor

Changes

This adds the HTML content-type header to astro pages. Without it, the browser may sometimes display an astro-rendered page as plain text.

Testing

Create an astro page without the optional <html> tag.

---
let cats = [{ name: "Meowser" }, { name: "Catatat" }, { name: "Mr. Kitty" }];
---

<template id="good-kitties">
	{cats.map(cat => (
		<li>{cat.name}</li>
	))}
</template>
<title>Good Kitties</title>
<body>
	<h1>Good Kitties</h1>
	<a href="https://www.youtube.com/watch?v=oHg5SJYRHA0">See more good kitties</a>
</body>

screenshot of the above page rendered as plain text

  • Tests are passing (unsure if this applies)
  • Tests updated where necessary (unsure if this applies)

Docs

  • Docs / READMEs updated (unsure if this is necessary)
  • Code comments added where helpful (unsure if this is necessary)

@matthewp
Copy link
Copy Markdown
Contributor

Thanks! Going to clarify today our contribution policy, then will try to get this in.

@jonathantneal
Copy link
Copy Markdown
Contributor Author

Sounds good, thanks! I know the drill; there’s a contribution agreement for w3c repos.

If I need to agree to any specific terms, let me know. 👍

@matthewp
Copy link
Copy Markdown
Contributor

All is good, thanks for this!

@matthewp matthewp merged commit 740a6b7 into main Apr 13, 2021
@matthewp matthewp deleted the jn.serve-html-content-type branch April 13, 2021 17:01
Princesseuh pushed a commit that referenced this pull request Oct 20, 2025
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants