From eaaf2513d7d98dceb34ae6a8616ac539870e9db5 Mon Sep 17 00:00:00 2001 From: Valerio Ageno <51341197+Valerioageno@users.noreply.github.com> Date: Tue, 4 Feb 2025 15:58:34 +0100 Subject: [PATCH] docs: add SSG page (#498) Co-authored-by: Marco Pasqualetti <24919330+marcalexiei@users.noreply.github.com> --- .../src/components/Sidebar/sidebarElements.ts | 6 +-- .../rendering/server-side-rendering.mdx | 2 +- .../rendering/static-site-generation.mdx | 39 +++++++++++++++++++ .../rendering/static-site-rendering.mdx | 14 ------- 4 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 apps/documentation/src/routes/documentation/rendering/static-site-generation.mdx delete mode 100644 apps/documentation/src/routes/documentation/rendering/static-site-rendering.mdx diff --git a/apps/documentation/src/components/Sidebar/sidebarElements.ts b/apps/documentation/src/components/Sidebar/sidebarElements.ts index 301b7ffc..8d1722cd 100644 --- a/apps/documentation/src/components/Sidebar/sidebarElements.ts +++ b/apps/documentation/src/components/Sidebar/sidebarElements.ts @@ -130,13 +130,13 @@ export const sidebarElements: Array = [ children: [ { type: 'element', - label: 'Server side rendering', + label: 'Server side rendering (SSR)', href: '/documentation/rendering/server-side-rendering', }, { type: 'element', - label: 'Static site rendering', - href: '/documentation/rendering/static-site-rendering', + label: 'Static site generation (SSG)', + href: '/documentation/rendering/static-site-generation', }, ], }, diff --git a/apps/documentation/src/routes/documentation/rendering/server-side-rendering.mdx b/apps/documentation/src/routes/documentation/rendering/server-side-rendering.mdx index c4835294..a043d611 100644 --- a/apps/documentation/src/routes/documentation/rendering/server-side-rendering.mdx +++ b/apps/documentation/src/routes/documentation/rendering/server-side-rendering.mdx @@ -7,7 +7,7 @@ import MetaTags from '@/components/MetaTags' import Breadcrumbs from '@/components/Breadcrumbs' - + # Server side rendering diff --git a/apps/documentation/src/routes/documentation/rendering/static-site-generation.mdx b/apps/documentation/src/routes/documentation/rendering/static-site-generation.mdx new file mode 100644 index 00000000..639fe41e --- /dev/null +++ b/apps/documentation/src/routes/documentation/rendering/static-site-generation.mdx @@ -0,0 +1,39 @@ +import MetaTags from '@/components/MetaTags' + + + +import Breadcrumbs from '@/components/Breadcrumbs' + + + +# Static Site Generation + +## Overview + +> 🚧 This feature is experimental and still misses few case scenarios. It will be stabilized soon. + +Tuono is a progressive framework that meets all development needs, +from building simple apps without server capabilities to creating fully server side rendered applications with dynamic data. + +If a page uses Static Generation, its HTML is generated at build time and reused on each request. +It can also be cached by a CDN. + +In Tuono, you can statically generate pages with or without data. + +> For the current development stage the whole app has to opt for SSG or SSR. Mixed rendering strategies are not available yet. + +## Usage + +To build a project statically just run: + +```sh +tuono build —-static +``` + +This command builds all the JS and CSS assets, and also pre-renders each page into its own separate `index.html` file. + +You can still use `#[tuono_lib::handler]` to load remote data, +but it will only be loaded at build time. diff --git a/apps/documentation/src/routes/documentation/rendering/static-site-rendering.mdx b/apps/documentation/src/routes/documentation/rendering/static-site-rendering.mdx deleted file mode 100644 index ccd3139a..00000000 --- a/apps/documentation/src/routes/documentation/rendering/static-site-rendering.mdx +++ /dev/null @@ -1,14 +0,0 @@ -import MetaTags from '@/components/MetaTags' - - - -import Breadcrumbs from '@/components/Breadcrumbs' - - - -# Static Site Rendering - -TODO