docs: Some minor bug fixes to improve reporting (#8917)

Signed-off-by: Charlie Egan <charlie_egan@apple.com>
This commit is contained in:
Charlie Egan
2026-07-21 11:49:44 +01:00
committed by GitHub
parent bdf1d301e0
commit efebe8044d
3 changed files with 36 additions and 2 deletions
+27
View File
@@ -0,0 +1,27 @@
// Redirect legacy *.html URLs to their extensionless equivalents. Runs as an
// edge function because a wildcard _redirects rule can't force a redirect
// away from a file that physically exists at the "from" path.
import { Context } from "@netlify/edge-functions";
const excluded: Set<string> = new Set([
"/netlify-forms.html",
"/docs/kubernetes-admission-control.html",
]);
export default async (
request: Request,
context: Context,
): Promise<Response | undefined> => {
const url: URL = new URL(request.url);
const pathname: string = url.pathname;
if (!pathname.endsWith(".html") || excluded.has(pathname)) {
return undefined;
}
url.pathname = pathname === "/index.html"
? "/"
: pathname.slice(0, -".html".length);
return Response.redirect(url.toString(), 301);
};
+4 -2
View File
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import Link from "@docusaurus/Link";
import useBaseUrl from "@docusaurus/useBaseUrl";
import Heading from "@theme/Heading";
import Layout from "@theme/Layout";
@@ -94,7 +95,7 @@ const EcosystemIndex = (props) => {
return (
<a
key={lang.id}
href={`./ecosystem/by-language/${lang.id}`}
href={useBaseUrl(`/ecosystem/by-language/${lang.id}`)}
className={styles.languageLink}
>
<img
@@ -128,7 +129,8 @@ const EcosystemIndex = (props) => {
<ul>
{featuresInCategory.map((feature) => (
<li key={feature.id}>
<a href={`./ecosystem/by-feature/${feature.id}`}>{feature.title}</a> {feature.description}
<a href={useBaseUrl(`/ecosystem/by-feature/${feature.id}`)}>{feature.title}</a> {" "}
{feature.description}
</li>
))}
</ul>
+5
View File
@@ -27,6 +27,11 @@ function = "badge"
path = "/docs/*"
function = "version-redirect"
# Canonicalize legacy .html URLs onto their clean-path equivalents.
[[edge_functions]]
path = "/*"
function = "clean-html-urls"
# function to process form notifications from netlify forms and send them to slack
[[edge_functions]]
path = "/api/feedback"