# General Translation React SDKs (gt-react, gt-next): Generazione statica del sito con Pages Router URL: https://generaltranslation.com/it/docs/react/nextjs/pages-router-static-site-generation.mdx --- title: Generazione statica del sito con Pages Router description: Come pre-renderizzare le pagine localizzate del Pages Router di Next.js con General Translation. related: links: - /docs/react/nextjs-pages-router-quickstart - /docs/react/nextjs/pages-router-middleware - /docs/react/guides/storing-translations --- Pre-renderizza le pagine localizzate del Pages Router con `withGTStaticProps`. La configurazione รจ analoga a `withGTServerSideProps`, ma Next.js genera le props in fase di build. ## Mantieni la configurazione Next.js [#config] La generazione statica non modifica il tuo setup di `withGTConfig`: ```ts title="next.config.ts" import type { NextConfig } from 'next'; import { withGTConfig } from 'gt-next/config'; const nextConfig: NextConfig = {}; export default withGTConfig(nextConfig); ``` ## Configura il routing delle impostazioni regionali [#routing] Segui la [guida al middleware del Pages Router](/docs/react/nextjs/pages-router-middleware) per creare `proxy.ts` e spostare le route in `pages/[locale]`. ## Aggiungi le props statiche [#static-props] Avvolgi la funzione `getStaticProps` di ogni pagina con `withGTStaticProps`: ```tsx title="pages/[locale]/about.tsx" import type { GetStaticProps } from 'next'; import { T, Var, withGTStaticProps } from 'gt-next'; type AboutPageProps = { generatedAt: string; }; export const getStaticProps: GetStaticProps = withGTStaticProps(async () => ({ props: { generatedAt: new Date().toISOString(), }, })); export default function AboutPage({ generatedAt }: AboutPageProps) { return Generated at: {generatedAt}; } ``` `withGTStaticProps` aggiunge l'impostazione regionale e lo snapshot di traduzione alle props della pagina restituita. Se la pagina non ha altre props, usa la forma senza argomenti: ```tsx title="pages/[locale]/index.tsx" import { withGTStaticProps } from 'gt-next'; export const getStaticProps = withGTStaticProps(); ``` Passa questi valori a `GTProvider` e [collega le modifiche all'impostazione regionale](/docs/react/nextjs/pages-router-middleware#locale-changes) in `_app.tsx`. ## Next steps - /docs/react/nextjs-pages-router-quickstart - /docs/react/nextjs/pages-router-middleware - /docs/react/guides/storing-translations