diff --git a/website/astro.config.mjs b/website/astro.config.mjs index b495713134e..84390e5b504 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -98,6 +98,7 @@ export default defineConfig({ tag: "script", attrs: { src: "https://consentdeliveryfd.azurefd.net/mscc/lib/v2/wcp-consent.js", + crossorigin: "anonymous", }, }, { @@ -106,6 +107,7 @@ export default defineConfig({ type: "module", async: true, src: "1ds-init.js", + integrity: "sha384-idYZGvEvTNaaqBGjIeT/diHjEM13+k+Utpb4k+TjTW/ui8yYALU1FXvgk+lG/EZG", }, }, ], diff --git a/website/src/content/docs/docs/handbook/configuration/configuration.mdx b/website/src/content/docs/docs/handbook/configuration/configuration.mdx index 2c53ec7ec14..68a491bc92d 100644 --- a/website/src/content/docs/docs/handbook/configuration/configuration.mdx +++ b/website/src/content/docs/docs/handbook/configuration/configuration.mdx @@ -1,5 +1,10 @@ --- title: Configuration +head: + - tag: meta + attrs: + name: robots + content: noindex --- import { FileTree } from "@astrojs/starlight/components"; diff --git a/website/src/layouts/base-layout.astro b/website/src/layouts/base-layout.astro index 4d2361eab40..8aef70ced5d 100644 --- a/website/src/layouts/base-layout.astro +++ b/website/src/layouts/base-layout.astro @@ -18,9 +18,14 @@ const { footer = true } = Astro.props; typespec.io - - + +
diff --git a/website/src/middleware.ts b/website/src/middleware.ts new file mode 100644 index 00000000000..4748975cb5a --- /dev/null +++ b/website/src/middleware.ts @@ -0,0 +1,19 @@ +import { defineMiddleware } from "astro:middleware"; + +export const onRequest = defineMiddleware(async (context, next) => { + const response = await next(); + const contentType = response.headers.get("content-type"); + + // Set charset=utf-8 for all HTML responses + if (contentType?.includes("text/html")) { + response.headers.set("content-type", "text/html; charset=utf-8"); + } + + // Disable directory indexing for the configuration page + const normalizedPath = context.url.pathname.replace(/\/$/, ""); + if (normalizedPath === "/docs/handbook/configuration/configuration") { + response.headers.set("X-Robots-Tag", "noindex"); + } + + return response; +});