Project

General

Profile

Static Site Generation » History » Revision 11

Revision 10 (Olivia Reichl, 2024-07-16 15:22) → Revision 11/12 (Olivia Reichl, 2024-07-16 15:22)

h1. Static Site Generation 

 Our goal with OpenAtlas Discovery is to make it easily possible to host as static site once a project using it has ended. To achieve this we make use of various technologies, this document is meant as a collection for all the relevant information regarding this. 

 h2. Used Technologies 

 * "Nuxt3 Static Site Generation":https://nuxt.com/docs/getting-started/deployment#static-hosting 
 * "NuxtImage":https://v1.image.nuxtjs.org/ 

 h2. Generating the Site 

 h3. Enviroment Variables 

 Enviroment variables enable us to make OA Discovery assign important variables ahead of time, like the URL of the site hosting the API for the backend. In static sites the enviroment variable "cannot be changed once it has be generated":https://nuxt.com/docs/guide/directory-structure/env#env-file, thus we need to make sure that the correct enviroment variable is provided at the time of generation. Though as we crawl the data from the backend in order to make the site static it should not pose a problem in most cases. 

 To work with nuxt and be available in the "nuxt runtime config":https://nuxt.com/docs/guide/going-further/runtime-config the enviroment variables need to follow the naming scheme "NUXT_PUBLIC_VAR_NAME" for public variables and "NUXT_VAR_NAME" for private ones. The naming sheme is explained in more detail "here":https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables. 

 h2. Generating a Static Site for the frontend-demos on the CRAWS servers 

 h3. Steps:  
 * Make sure the right environment variables are declared: NUXT_PUBLIC_API_BASE_URL &    NUXT_PUBLIC_OPEN_API_BASE_URL => are using https://demo.openatlas.eu/ or https://demo-dev.openatlas.eu/, set the NUXT_PUBLIC_SPECIAL_IMPRINT to "enabled" to render the custom imprint with Alex's email address. 

 * Generate the site with: 
 <pre><code class="shell"> 
 pnpm run generate 
 </code></pre> 

 * Zip the generated '.output'-folder and send it to Alex