Fixing SEO
SEOFIX Connect for Next.js
A small add-on file for App Router sites (Next.js 13.4 and newer).
- 1Download seofix.ts from Connect site → Next.js and save it as src/lib/seofix.ts. For redirects, also add seofix-middleware.ts.
- 2Add SEOFIX_KEY=<your site key> to your environment (and your hosting provider's settings). Rebuild.
- 3In each page, wrap your metadata: export async function generateMetadata(props, parent) { return withSeofix("/page/path", yourMetadata, parent) }. Pages that export a static metadata object become a generateMetadata function that returns it.
- 4Add app/api/seofix/route.ts containing: export { seofixWebhook as POST } from "@/lib/seofix" — SEOFIX calls it (signed with your key) so changes appear instantly.
- 5Optional: in middleware.ts (proxy.ts on Next 16) return seofixRedirect(req) for SEOFIX-managed 301 redirects.
- 6Deploy, then click Test connection in SEOFIX.
A page only shows SEOFIX changes if its metadata is wrapped with withSeofix. If a change can't be verified on a page, SEOFIX switches it off automatically and tells you which page.
Titles are applied as absolute titles (your title template isn't added again). Data is cached for 5 minutes and refreshed instantly by the webhook; if SEOFIX is unreachable the last known values are used.
Still stuck? Email support@seofix.pro.