Next.js / SEO

Step 19 of 24

Configure SEO, sitemaps e Search Console.

Forneça aos motores de busca a origem pública correta e uma forma fiável de descobrir as suas páginas Next.js localizadas.

Set the public HTTPS origin of the frontend in the production environment. Use the real site URL without a trailing slash; do not use localhost, a preview hostname, the Altified dashboard, or the API domain.

.env.local or hosting environment
NEXT_PUBLIC_SITE_URL=https://www.example.com

Altified uses this value for generated sitemap and robots routes, metadata origins, canonical URLs, and alternate-language URLs. For custom XML or static sitemaps, set ALTIFIED_SITE_URL or NEXT_PUBLIC_SITE_URL explicitly so the SDK reads only the intended public host.

Keep the site sitemap complete

Your application must already expose a site-owned /sitemap.xml. It may come from app/sitemap.js or app/sitemap.ts, or from a published custom XML/static sitemap.

Include every public page, including dynamic pages such as products, articles, jobs, or documentation routes. Altified uses this sitemap as its source and does not invent URLs that your site omits. If there is no sitemap yet, create the site-owned sitemap first and then run altified init.

Run the initializer

When a site sitemap exists, altified init keeps /sitemap.xml unchanged and adds a separate Altified index at:

Generated public routes
https://www.example.com/altified-sitemap.xml https://www.example.com/altified-sitemaps/fr-0.xml

The Altified sitemap contains only additional-language URLs. The initializer also adds /altified-sitemap.xml to an existing robots.js, robots.ts, or robots.txt when it can safely identify the format.

Read initializer warnings

If the initializer cannot update an unusual robots implementation or static file, make the reported manual change. You can also submit the Altified sitemap directly in Google Search Console.

Submit the Altified sitemap

After deployment, open the Google Search Console property for the same frontend origin and submit the Altified sitemap:

Sitemap URL
https://www.example.com/altified-sitemap.xml

Keep the original site sitemap submitted or discoverable as well. Submitting the Altified sitemap helps search engines discover translated URLs; it does not replace the site sitemap or add hreflang annotations by itself.

Verify before publishing

  • NEXT_PUBLIC_SITE_URL matches the deployed frontend origin.
  • The site's /sitemap.xml returns successfully and includes all public dynamic pages.
  • /altified-sitemap.xml returns successfully after target locales and routing are published.
  • The localized child sitemap URLs returned by the index are reachable.
  • robots.js or robots.txt lists both the site sitemap and the Altified sitemap, or the Altified sitemap has been submitted directly in Search Console.
  • Default and translated pages contain reciprocal hreflang links and a self-canonical URL.
  • Translated pages are indexable and actually contain translated content.