summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/chilly-carrots-think.md5
-rw-r--r--packages/astro/src/runtime/server/render/page.ts1
2 files changed, 6 insertions, 0 deletions
diff --git a/.changeset/chilly-carrots-think.md b/.changeset/chilly-carrots-think.md
new file mode 100644
index 000000000..a90ab8715
--- /dev/null
+++ b/.changeset/chilly-carrots-think.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+preventing multiple doctype injection into html documents
diff --git a/packages/astro/src/runtime/server/render/page.ts b/packages/astro/src/runtime/server/render/page.ts
index 7562c8563..70445ee41 100644
--- a/packages/astro/src/runtime/server/render/page.ts
+++ b/packages/astro/src/runtime/server/render/page.ts
@@ -30,6 +30,7 @@ async function iterableToHTMLBytes(
for await (const chunk of iterable) {
if (isHTMLString(chunk)) {
if (i === 0) {
+ i++;
if (!/<!doctype html/i.test(String(chunk))) {
parts.append('<!DOCTYPE html>\n', result);
if (onDocTypeInjection) {