From 6cc09ad5a5578f25092e58f90b3531e75648621b Mon Sep 17 00:00:00 2001
From: Nathan Totten
Date: Mon, 9 Oct 2023 13:20:44 -0400
Subject: [PATCH] basepath
---
next.config.mjs | 8 +-
src/app/{docs => }/[...slug]/page.tsx | 0
.../{docs => }/articles/node-modules/page.tsx | 0
src/app/not-found.tsx | 2 +-
src/app/{docs => }/policies/[slug]/page.tsx | 0
src/app/{docs => }/policies/page.tsx | 15 +-
src/components/Search.tsx | 2 +-
src/lib/content.ts | 4 +-
src/lib/navigation.ts | 162 +++++++++---------
9 files changed, 93 insertions(+), 100 deletions(-)
rename src/app/{docs => }/[...slug]/page.tsx (100%)
rename src/app/{docs => }/articles/node-modules/page.tsx (100%)
rename src/app/{docs => }/policies/[slug]/page.tsx (100%)
rename src/app/{docs => }/policies/page.tsx (77%)
diff --git a/next.config.mjs b/next.config.mjs
index a9208ea9..38d82f19 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -4,6 +4,7 @@ import withSearch from "./src/markdoc/search.mjs";
const nextConfig = {
swcMinify: true,
reactStrictMode: true,
+ basePath: "/docs",
images: {
deviceSizes: [576, 640, 760, 828, 992, 1180, 1440],
imageSizes: [96, 128, 256, 384],
@@ -15,13 +16,6 @@ const nextConfig = {
},
],
},
- redirects: async () => [
- {
- source: "/",
- destination: "/docs",
- statusCode: 308,
- },
- ],
webpack(config) {
config.module.rules.push({
test: /\.svg$/i,
diff --git a/src/app/docs/[...slug]/page.tsx b/src/app/[...slug]/page.tsx
similarity index 100%
rename from src/app/docs/[...slug]/page.tsx
rename to src/app/[...slug]/page.tsx
diff --git a/src/app/docs/articles/node-modules/page.tsx b/src/app/articles/node-modules/page.tsx
similarity index 100%
rename from src/app/docs/articles/node-modules/page.tsx
rename to src/app/articles/node-modules/page.tsx
diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx
index 82c6c2ce..1852a4d5 100644
--- a/src/app/not-found.tsx
+++ b/src/app/not-found.tsx
@@ -14,7 +14,7 @@ export default function NotFound() {
Sorry, we couldn’t find the page you’re looking for.
Go back to docs
diff --git a/src/app/docs/policies/[slug]/page.tsx b/src/app/policies/[slug]/page.tsx
similarity index 100%
rename from src/app/docs/policies/[slug]/page.tsx
rename to src/app/policies/[slug]/page.tsx
diff --git a/src/app/docs/policies/page.tsx b/src/app/policies/page.tsx
similarity index 77%
rename from src/app/docs/policies/page.tsx
rename to src/app/policies/page.tsx
index b197a541..4d1591b6 100644
--- a/src/app/docs/policies/page.tsx
+++ b/src/app/policies/page.tsx
@@ -1,7 +1,7 @@
import { Metadata } from "next";
import Link from "next/link";
-import { DocsHeader } from "../../../components/DocsHeader";
-import { getAllPolicies } from "../../../lib/policies";
+import { DocsHeader } from "../../components/DocsHeader";
+import { getAllPolicies } from "../../lib/policies";
export const metadata: Metadata = {
title: "Policies",
@@ -16,15 +16,14 @@ export default async function Page() {
Zuplo includes policies for any solution you need for securing and
sharing your API. See the{" "}
- policy introduction to learn about
- using policies.
+ policy introduction to learn about using
+ policies.
- The CORS policy is
- a special type of policy that is configured separately. Check out
- details
- here.
+ The CORS policy is a
+ special type of policy that is configured separately. Check out details
+ here.
>({
const result: Content = {
source: vfile,
data: data as Data,
- href: `/docs/${slug}`,
+ href: `/${slug}`,
slug,
};
return result;
@@ -63,7 +63,7 @@ export async function getAllContent>(options?: {
const result: Content = {
source: content,
data: data as Data,
- href: file.replace(".md", ""),
+ href: file.substring(5).replace(".md", ""),
// Remove the /docs
slug: file.substring(5).replace(".md", "").split("/"),
};
diff --git a/src/lib/navigation.ts b/src/lib/navigation.ts
index 2aed889c..dc46335a 100644
--- a/src/lib/navigation.ts
+++ b/src/lib/navigation.ts
@@ -12,14 +12,14 @@ export const navigation: NavSection[] = [
{
title: "Introduction",
links: [
- { title: "What is Zuplo?", href: "/docs/articles/what-is-zuplo" },
+ { title: "What is Zuplo?", href: "/articles/what-is-zuplo" },
{
title: "Who uses Zuplo, and why?",
- href: "/docs/articles/who-uses-and-why",
+ href: "/articles/who-uses-and-why",
},
{
title: "Zuplo in your stack",
- href: "/docs/articles/zuplo-in-your-stack",
+ href: "/articles/zuplo-in-your-stack",
},
],
},
@@ -28,74 +28,74 @@ export const navigation: NavSection[] = [
links: [
{
title: "Step 1 - Setup a Basic Gateway",
- href: "/docs/articles/step-1-setup-basic-gateway",
+ href: "/articles/step-1-setup-basic-gateway",
},
{
title: "Step 2 - API Key Authentication",
- href: "/docs/articles/step-2-add-api-key-auth",
+ href: "/articles/step-2-add-api-key-auth",
},
{
title: "Step 3 - Rate Limiting",
- href: "/docs/articles/step-3-add-rate-limiting",
+ href: "/articles/step-3-add-rate-limiting",
},
{
title: "Step 4 - Deploying to the Edge",
- href: "/docs/articles/step-4-deploying-to-the-edge",
+ href: "/articles/step-4-deploying-to-the-edge",
},
],
},
{
title: "Getting to Production",
links: [
- { title: "Environments", href: "/docs/articles/environments" },
+ { title: "Environments", href: "/articles/environments" },
{
title: "GitHub Integration",
- href: "/docs/articles/github-source-control",
+ href: "/articles/github-source-control",
},
{
title: "Securing your backend",
- href: "/docs/articles/securing-your-backend",
+ href: "/articles/securing-your-backend",
},
{
title: "Custom Domains",
- href: "/docs/articles/custom-domains",
+ href: "/articles/custom-domains",
},
- { title: "Testing", href: "/docs/articles/testing" },
+ { title: "Testing", href: "/articles/testing" },
{
title: "Zuplo in your stack",
- href: "/docs/articles/zuplo-in-your-stack",
+ href: "/articles/zuplo-in-your-stack",
},
- { title: "Log Plugins", href: "/docs/articles/log-plugins" },
+ { title: "Log Plugins", href: "/articles/log-plugins" },
],
},
{
title: "API Keys",
links: [
- { title: "Overview", href: "/docs/articles/api-key-management" },
+ { title: "Overview", href: "/articles/api-key-management" },
{
title: "Authentication",
- href: "/docs/articles/api-key-authentication",
+ href: "/articles/api-key-authentication",
},
{
title: "End User Access",
- href: "/docs/articles/api-key-end-users",
+ href: "/articles/api-key-end-users",
},
- { title: "Using the API", href: "/docs/articles/api-key-api" },
+ { title: "Using the API", href: "/articles/api-key-api" },
{
title: "React Component",
- href: "/docs/articles/api-key-react-component",
+ href: "/articles/api-key-react-component",
},
{
title: "Leak Detection",
- href: "/docs/articles/api-key-leak-detection",
+ href: "/articles/api-key-leak-detection",
},
{
title: "Service Limits",
- href: "/docs/articles/api-key-service-limits",
+ href: "/articles/api-key-service-limits",
},
{
title: "Buckets & Environments",
- href: "/docs/articles/api-key-buckets",
+ href: "/articles/api-key-buckets",
},
],
},
@@ -108,70 +108,70 @@ export const navigation: NavSection[] = [
links: [
{
title: "Running your Zuplo Gateway locally",
- href: "/docs/articles/local-development",
+ href: "/articles/local-development",
},
{
title: "Configuring your IDE for Local Development",
- href: "/docs/articles/configure-ide-for-local-development",
+ href: "/articles/configure-ide-for-local-development",
},
],
},
- { title: "Custom CI/CD", href: "/docs/articles/custom-ci-cd" },
+ { title: "Custom CI/CD", href: "/articles/custom-ci-cd" },
{
title: "Rename/Move Project",
- href: "/docs/articles/rename-or-move-project",
+ href: "/articles/rename-or-move-project",
},
{
title: "Add project collaborators",
- href: "/docs/articles/add-project-collaborators",
+ href: "/articles/add-project-collaborators",
},
{
title: "Multiple Auth Policies",
- href: "/docs/articles/multiple-auth-policies",
+ href: "/articles/multiple-auth-policies",
},
{
title: "Archiving requests to storage",
- href: "/docs/articles/archiving-requests-to-storage",
+ href: "/articles/archiving-requests-to-storage",
},
{
title: "Per user rate-limiting using a database and the ZoneCache",
- href: "/docs/articles/per-user-rate-limits-using-db",
+ href: "/articles/per-user-rate-limits-using-db",
},
{
title: "Rick and Morty Developer Portal and Documentation",
- href: "/docs/articles/rick-and-morty-api-developer-portal-example",
+ href: "/articles/rick-and-morty-api-developer-portal-example",
},
{
title: "How to check an incoming IP address",
- href: "/docs/articles/check-ip-address",
+ href: "/articles/check-ip-address",
},
{
title: "Custom Logging Policy",
- href: "/docs/articles/custom-logging-example",
+ href: "/articles/custom-logging-example",
},
{
title: "Custom Log Level",
- href: "/docs/articles/custom-log-level",
+ href: "/articles/custom-log-level",
},
{
title: "Advanced Path Matching",
- href: "/docs/articles/advanced-path-matching",
+ href: "/articles/advanced-path-matching",
},
{
title: "Lazy Load Configuration",
- href: "/docs/articles/lazy-load-configuration-into-cache",
+ href: "/articles/lazy-load-configuration-into-cache",
},
{
title: "Handling FormData",
- href: "/docs/articles/handling-form-data",
+ href: "/articles/handling-form-data",
},
{
title: "Testing GraphQL Queries",
- href: "/docs/articles/testing-graphql",
+ href: "/articles/testing-graphql",
},
{
title: "Secure a GCP Backend with Zuplo Upstream Auth",
- href: "/docs/articles/gke-with-upstream-auth-policy",
+ href: "/articles/gke-with-upstream-auth-policy",
},
],
},
@@ -181,21 +181,21 @@ export const navigation: NavSection[] = [
{
title: "Handlers",
links: [
- { title: "URL Forward", href: "/docs/handlers/url-forward" },
- { title: "URL Rewrite", href: "/docs/handlers/url-rewrite" },
+ { title: "URL Forward", href: "/handlers/url-forward" },
+ { title: "URL Rewrite", href: "/handlers/url-rewrite" },
{
title: "Custom Handler",
- href: "/docs/handlers/custom-handler",
+ href: "/handlers/custom-handler",
},
- { title: "AWS Lambda", href: "/docs/handlers/aws-lambda" },
- { title: "Redirect", href: "/docs/handlers/redirect" },
+ { title: "AWS Lambda", href: "/handlers/aws-lambda" },
+ { title: "Redirect", href: "/handlers/redirect" },
{
title: "OpenAPI Spec Handler",
- href: "/docs/handlers/openapi",
+ href: "/handlers/openapi",
},
{
title: "Internal Route Handlers",
- href: "/docs/handlers/system-handlers",
+ href: "/handlers/system-handlers",
},
],
},
@@ -204,37 +204,37 @@ export const navigation: NavSection[] = [
links: [
{
title: "Overview",
- href: "/docs/articles/developer-portal",
+ href: "/articles/developer-portal",
},
- { title: "Setup", href: "/docs/articles/dev-portal-setup" },
+ { title: "Setup", href: "/articles/dev-portal-setup" },
{
title: "OpenAPI Specifications",
- href: "/docs/articles/dev-portal-configuration",
+ href: "/articles/dev-portal-configuration",
},
{
title: "Authentication",
- href: "/docs/articles/dev-portal-auth",
+ href: "/articles/dev-portal-auth",
},
{
title: "Supabase Auth",
- href: "/docs/articles/dev-portal-supabase-auth",
+ href: "/articles/dev-portal-supabase-auth",
},
- { title: "Theming", href: "/docs/articles/dev-portal-theme" },
+ { title: "Theming", href: "/articles/dev-portal-theme" },
{
title: "Custom Pages",
- href: "/docs/articles/dev-portal-adding-pages",
+ href: "/articles/dev-portal-adding-pages",
},
{
title: "Sidebar Configuration",
- href: "/docs/articles/dev-portal-configuring-sidebar",
+ href: "/articles/dev-portal-configuring-sidebar",
},
{
title: "Config (dev-portal.json)",
- href: "/docs/articles/dev-portal-json",
+ href: "/articles/dev-portal-json",
},
{
title: "Create an API Key Consumer on Login",
- href: "/docs/articles/dev-portal-create-consumer-on-auth",
+ href: "/articles/dev-portal-create-consumer-on-auth",
},
],
},
@@ -243,54 +243,54 @@ export const navigation: NavSection[] = [
links: [
{
title: "ZuploRequest",
- href: "/docs/articles/zuplo-request",
+ href: "/articles/zuplo-request",
},
{
title: "Environment Variables",
- href: "/docs/articles/environment-variables",
+ href: "/articles/environment-variables",
},
{
title: "ZuploContext",
- href: "/docs/articles/zuplo-context",
+ href: "/articles/zuplo-context",
},
{
title: "Web Standard APIs",
- href: "/docs/articles/web-standard-apis",
+ href: "/articles/web-standard-apis",
},
{
title: "Web Crypto",
- href: "/docs/articles/web-crypto-apis",
+ href: "/articles/web-crypto-apis",
},
{
title: "Node Modules",
- href: "/docs/articles/node-modules",
+ href: "/articles/node-modules",
},
{
title: "Problem Details Helper",
- href: "/docs/articles/http-problems",
+ href: "/articles/http-problems",
},
- { title: "Code Reuse", href: "/docs/articles/reusing-code" },
- { title: "ZoneCache", href: "/docs/articles/zone-cache" },
+ { title: "Code Reuse", href: "/articles/reusing-code" },
+ { title: "ZoneCache", href: "/articles/zone-cache" },
{
title: "Clone Request/Response",
- href: "/docs/articles/safely-clone-a-request-or-response",
+ href: "/articles/safely-clone-a-request-or-response",
},
{
title: "Runtime Behaviors",
- href: "/docs/articles/runtime-behaviors",
+ href: "/articles/runtime-behaviors",
},
{
title: "zp-body-removed",
- href: "/docs/articles/zp-body-removed",
+ href: "/articles/zp-body-removed",
},
- { title: "Audit Log", href: "/docs/articles/audit-log" },
+ { title: "Audit Log", href: "/articles/audit-log" },
{
title: "Runtime Extensions",
- href: "/docs/articles/runtime-extensions",
+ href: "/articles/runtime-extensions",
},
{
title: "Custom Not Found Handler",
- href: "/docs/articles/not-found-handler",
+ href: "/articles/not-found-handler",
},
],
},
@@ -299,20 +299,20 @@ export const navigation: NavSection[] = [
links: [
{
title: "Installing the Zuplo CLI",
- href: "/docs/cli/installation",
+ href: "/cli/installation",
},
- { title: "Analytics", href: "/docs/cli/analytics" },
- { title: "Authentication", href: "/docs/cli/authentication" },
- { title: "Conversion Commands", href: "/docs/cli/convert" },
+ { title: "Analytics", href: "/cli/analytics" },
+ { title: "Authentication", href: "/cli/authentication" },
+ { title: "Conversion Commands", href: "/cli/convert" },
{
title: "Deployment Commands",
- href: "/docs/cli/deployments",
+ href: "/cli/deployments",
},
- { title: "Test Command", href: "/docs/cli/test" },
- { title: "Tunnel Commands", href: "/docs/cli/tunnels" },
+ { title: "Test Command", href: "/cli/test" },
+ { title: "Tunnel Commands", href: "/cli/tunnels" },
{
title: "Environment Variables Commands",
- href: "/docs/cli/variables",
+ href: "/cli/variables",
},
],
},
@@ -321,9 +321,9 @@ export const navigation: NavSection[] = [
{
title: "Product Info",
links: [
- { title: "Support Plans", href: "/docs/articles/support" },
+ { title: "Support Plans", href: "/articles/support" },
{ title: "Changelog", href: "https://zuplo.com/changelog" },
- { title: "Security", href: "/docs/articles/security" },
+ { title: "Security", href: "/articles/security" },
{ title: "Trust & Compliance", href: "https://trust.zuplo.com" },
],
},