Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): 301 redirect deleted agent-team blog slug (#384)

LindsayLiu7778f117c5ed209
diff --git a/codecov.yml b/codecov.yml
index 859889384..a867141fc 100644
--- a/codecov.yml
+++ b/codecov.yml
@@ -28,6 +28,9 @@ coverage:
ignore:
- "src/web/src/components/home/**"
- "src/web/scripts/**"
+ # Next config is loaded by the Next runtime, not vitest — redirects live in
+ # `src/web/src/lib/blog/redirects.ts` (unit-tested) and are wired here only.
+ - "src/web/next.config.ts"
# Playwright browser E2E — driven by `playwright test`, not vitest, so these
# files never appear in coverage and shouldn't count against patch %.
- "src/web/src/test/e2e-ui/**"
diff --git a/src/web/next.config.ts b/src/web/next.config.ts
index 11bf9400c..9714584b3 100644
--- a/src/web/next.config.ts
+++ b/src/web/next.config.ts
@@ -2,6 +2,7 @@ import type { NextConfig } from "next";
import path from "node:path";
import { readFileSync } from "node:fs";
import createMDX from "@next/mdx";
+import { blogRedirects } from "./src/lib/blog/redirects";
const pkg = JSON.parse(readFileSync(path.resolve(__dirname, "package.json"), "utf-8"));
@@ -17,6 +18,9 @@ const nextConfig: NextConfig = {
root: path.resolve(__dirname, "../.."),
},
pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx"],
+ async redirects() {
+ return blogRedirects();
+ },
};
const withMDX = createMDX({
diff --git a/src/web/src/lib/blog/redirects.test.ts b/src/web/src/lib/blog/redirects.test.ts
new file mode 100644
index 000000000..26977409b
--- /dev/null
+++ b/src/web/src/lib/blog/redirects.test.ts
@@ -0,0 +1,14 @@
+import { describe, expect, it } from "vitest";
+import { blogRedirects } from "./redirects";
+
+describe("blogRedirects", () => {
+ it("301s the deleted agent-team slug to ai-agent-team", () => {
+ expect(blogRedirects()).toEqual([
+ {
+ source: "/blog/building-your-first-agent-team",
+ destination: "/blog/ai-agent-team",
+ statusCode: 301,
+ },
+ ]);
+ });
+});
diff --git a/src/web/src/lib/blog/redirects.ts b/src/web/src/lib/blog/redirects.ts
new file mode 100644
index 000000000..e77801719
--- /dev/null
+++ b/src/web/src/lib/blog/redirects.ts
@@ -0,0 +1,16 @@
+export type BlogRedirect = {
+ source: string;
+ destination: string;
+ statusCode: 301;
+};
+
+/** Permanent blog slug redirects for Next.js `redirects()`. */
+export function blogRedirects(): BlogRedirect[] {
+ return [
+ {
+ source: "/blog/building-your-first-agent-team",
+ destination: "/blog/ai-agent-team",
+ statusCode: 301,
+ },
+ ];
+}