In the production build, Rspress will automatically generate a static site for you, that is, generate the HTML content of each page. After the build is completed, the HTML will appear in the default product directory, such as:
You can deploy the contents of this product directory to any static site hosting service, such as GitHub Pages, Netlify, Vercel, etc.
The essence of static site generation is to pre-render components at the build stage, render the components into HTML strings, and then write them into HTML files. This has many benefits, such as:
Considering the cost of static site generation, Rspress only pre-renders during production environment builds. In the development environment, it still uses the traditional SPA rendering mode without pre-rendering.
Through builderConfig.html.tags
, you can customize the site HTML content, such as adding statistical code, adding scripts and styles, etc.
For more detailed config of builderConfig.html.tags
, please refer to the documentation.
After the production build is complete, you can preview the output by using the rspress preview
command. This command will start a local static site service, and you can access this service in your browser to preview the output.
If you do not want to use Static Site Generation, you can disable it through the ssg
config.
Please be cautious when disabling SSG, as this will forfeit many of the advantages of Static Site Generation mentioned above.