# General Translation React SDKs (gt-react, gt-next): Generación estática de sitios en Pages Router URL: https://generaltranslation.com/es/docs/react/nextjs/pages-router-static-site-generation.mdx --- title: Generación estática de sitios en Pages Router description: Cómo renderizar previamente páginas localizadas del Pages Router de Next.js con General Translation. related: links: - /docs/react/nextjs-pages-router-quickstart - /docs/react/nextjs/pages-router-middleware - /docs/react/guides/storing-translations --- Renderiza previamente páginas localizadas de Pages Router con `withGTStaticProps`. La configuración sigue el mismo patrón que `withGTServerSideProps`, pero Next.js genera las props en tiempo de compilación. ## Mantén la configuración de Next.js [#config] La generación estática no cambia la configuración de `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 el enrutamiento por configuración regional [#routing] Sigue la [guía de middleware del Pages Router](/docs/react/nextjs/pages-router-middleware) para crear `proxy.ts` y mover tus rutas a `pages/[locale]`. ## Agregar props estáticas [#static-props] Envuelve la función `getStaticProps` de cada página 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` agrega la configuración regional y la instantánea de traducción a las props de página que se devuelven. Si la página no tiene otras props, usa la forma sin argumentos: ```tsx title="pages/[locale]/index.tsx" import { withGTStaticProps } from 'gt-next'; export const getStaticProps = withGTStaticProps(); ``` Pasa esos valores a `GTProvider` e [integra los cambios de configuración regional](/docs/react/nextjs/pages-router-middleware#locale-changes) en `_app.tsx`. ## Next steps - /docs/react/nextjs-pages-router-quickstart - /docs/react/nextjs/pages-router-middleware - /docs/react/guides/storing-translations