Next.js

Next.js Proxy-Free Guide: Server-Rendered Metadata for SEO

Learn how to implement a Next.js proxy-free setup using server-rendered metadata and hosted Markdown for optimal SEO. Expose Legible discovery tags effectively.

6 min readUpdated 2026-03-21Proxy-Free Guides
Why this matters

Next.js is a strong fit for proxy-free mode when you generate the discovery tags on the server and avoid client-only metadata injection.

Root Layout Tags

Add the Legible global tags in `app/layout.tsx` or your equivalent root head output so they are present in the initial HTML.

Page-Level Markdown Alternate

  • Prefer `generateMetadata` or server-rendered head output over client components.
  • If your route structure is nested, build the Legible URL from the exact slug or path format your hosted endpoint expects.
export async function generateMetadata({
  params,
}: {
  params: Promise<{ slug: string }>;
}) {
  const { slug } = await params;

  return {
    alternates: {
      types: {
        "text/markdown": `https://read.yourdomain.com/${slug}.md`,
      },
    },
  };
}

Verification

  • Use `View Source` and confirm the tags are in the initial HTML.
  • Check one hosted Markdown endpoint and compare it with the visible page content.
  • If the tag appears only after hydration, move it to server-rendered metadata.