mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
docs: Some minor bug fixes to improve reporting (#8917)
Signed-off-by: Charlie Egan <charlie_egan@apple.com>
This commit is contained in:
@@ -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);
|
||||
};
|
||||
@@ -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>
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user