Rust library to generate static websites
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: document recent features

+111 -3
-1
crates/maudit/src/route.rs
··· 237 237 /// ## Example 238 238 /// ```rust 239 239 /// use maudit::route::prelude::*; 240 - /// 241 240 /// # #[route("/other_page")] 242 241 /// # pub struct OtherPage; 243 242 /// # impl Route for OtherPage {
+2 -1
website/content/docs/content.md
··· 15 15 Content sources are defined in the coronate entry point through the `content_sources!` macro. 16 16 17 17 ```rs 18 + use maudit::{coronate, routes, BuildOptions}; 18 19 use maudit::content::{content_sources, markdown_entry, glob_markdown}; 19 20 20 21 #[markdown_entry] ··· 32 33 "source_name" => loader(...), 33 34 "another_source" => glob_markdown::<BlogPost>("path/to/files/*.md") 34 35 ], 35 - Default::default() 36 + BuildOptions::default() 36 37 ); 37 38 } 38 39 ```
+27
website/content/docs/prefetching.md
··· 1 + --- 2 + title: "Prefetching" 3 + section: "core-concepts" 4 + --- 5 + 6 + A downside of MPAs (Multi-Page Applications) contrary to SPAs (Single-Page Applications) is that navigating to other pages is often noticeably slower, as the browser has to load a totally new HTML document instead of just updating part of the current document. 7 + 8 + Maudit has built-in support for prefetching pages before the user navigates to them, offering near-instant navigation, even for a MPA. 9 + 10 + Prefetching is enabled by default and the default strategy is to prefetch pages on click down. 11 + 12 + ## Configuration 13 + 14 + Prefetching can be configured using the `prefetch` property of [`BuildOptions`](https://docs.rs/maudit/latest/maudit/struct.BuildOptions.html) which takes a [`PrefetchOptions`](https://docs.rs/maudit/latest/maudit/struct.PrefetchOptions.html) struct. Currently, the only option is `strategy`. 15 + 16 + ```rs 17 + use maudit::{BuildOptions, PrefetchOptions, PrefetchStrategy}; 18 + 19 + BuildOptions { 20 + prefetch: PrefetchOptions { 21 + strategy: PrefetchStrategy::Hover, 22 + }, 23 + ..Default.default() 24 + } 25 + ``` 26 + 27 + To disable prefetching, set `strategy` to [`PrefetchStrategy::None`](https://docs.rs/maudit/latest/maudit/enum.PrefetchStrategy.html#variant.None).
+22
website/content/docs/routing.md
··· 198 198 - `/de/kontakt` 199 199 200 200 Calling `render()` three times with a different `ctx.variant` each time. 201 + 202 + ## Redirects 203 + 204 + Maudit supports creating redirects to other pages using the [meta http-equiv](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta/http-equiv#refresh) HTML tag, which can be built ergonomically using the [`redirect`](https://docs.rs/maudit/latest/maudit/route/fn.redirect.html) function. 205 + 206 + ```rs 207 + use maudit::route::prelude::*; 208 + 209 + #[route("/redirect")] 210 + pub struct Redirect; 211 + 212 + impl Route for Redirect { 213 + fn render(&self, ctx: &mut PageContext) -> impl Into<RenderResult> { 214 + redirect("https://example.com") 215 + 216 + // Use a page's url method to generate type safe links: 217 + // redirect(&OtherPage.url(None)) 218 + } 219 + } 220 + ``` 221 + 222 + The platform you're deploying your website to might also support a native way to do redirects that could be better suited if your redirects do not need runtime logic (i.e. your redirect is static, for instance `/blog` became `/article`). For example, [Netlify](https://docs.netlify.com/manage/routing/redirects/overview/) and [Cloudflare](https://developers.cloudflare.com/workers/static-assets/redirects/#_top) supports adding `_redirects` files to your projects to configure redirects.
+56
website/content/news/2026-in-the-cursed-lands.md
··· 1 + --- 2 + title: "What's new in Maudit and what's coming in 2026" 3 + description: "What is creeping around these cursed lands" 4 + author: The Maudit Team 5 + date: 2025-10-15 6 + --- 7 + 8 + **How dusty are these shelves!** And yet, new books have found themselves nestled among the ancient tomes, ready to be discovered by those brave enough to explore these cursed lands. 9 + 10 + Last summer we were very happy to introduce to you Maudit, a Rust library to generate static websites, then at version 0.1, but already quite mighty. This time we're back to talk about what we've been up to recently and what's coming this year. 11 + 12 + > Interested in trying out Maudit? Follow our [Quick Start](/docs/quick-start/) guide. 13 + 14 + ## Built-in sitemap generation 15 + 16 + [Maudit 0.9.0](https://github.com/bruits/maudit/releases/tag/maudit-v0.9.0) added support for automatically generating a sitemap for your website. In this new world of AI and other advanced web crawlers, sitemaps are a bit of an old relic. However, they're still considered useful to ensure that search engines properly index your website. 17 + 18 + To make Maudit generate a sitemap, first configure the [`base_url` property](https://docs.rs/maudit/latest/maudit/struct.BuildOptions.html#structfield.base_url) on `BuildOptions` to your website's address and then enable sitemaps by setting [`sitemap`](https://docs.rs/maudit/latest/maudit/struct.BuildOptions.html#structfield.sitemap) with a [SitemapOptions](https://docs.rs/maudit/latest/maudit/sitemap/struct.SitemapOptions.html) struct with `enabled: true`. 19 + 20 + ```rust 21 + use maudit::{BuildOptions, SitemapOptions, content_sources, coronate, routes}; 22 + 23 + fn main() { 24 + coronate( 25 + routes![], 26 + content_sources![], 27 + BuildOptions { 28 + base_url: Some("https://example.com".into()), 29 + sitemap: SitemapOptions { 30 + enabled: true, 31 + ..Default::default() 32 + }, 33 + ..Default::default() 34 + }, 35 + ); 36 + } 37 + ``` 38 + 39 + With this, building your website will now result in a `sitemap.xml` file being generated inside your `dist` folder which includes all the pages of your website. Maudit will also automatically handle separating your sitemap in multiple files if you have over the recommended amount of maximum 50000 pages per sitemap. 40 + 41 + For more information on sitemap generation in Maudit, check [our Sitemap documentation](/docs/sitemap/). 42 + 43 + ## Automatic prefetching 44 + 45 + A common complaint about MPAs (Multi-Page Applications) is that navigating between page is slow, especially compared to the app-like experience of SPAs (Single-Page Applications). 46 + 47 + The solution to this problem is to prefetch pages before the user navigate to them, like SPAs typically do, allowing near-instant navigations in most cases. 48 + 49 + Since [Maudit 0.10.0](https://github.com/bruits/maudit/releases/tag/maudit-v0.10.0), Maudit will by default prefetch links on clickdown, improving page loads by around 80ms on average, with other prefetching strategies available such as prefetching on hover. 50 + 51 + <video autoplay controls loop> 52 + <source src="/prefetch.mp4" type="video/mp4"> 53 + </video> 54 + <span class="text-center block italic">Showing the Hover strategy for prefetching</span> 55 + 56 + For more information on prefetching, see [our prefetching documentation](/docs/prefetching/).
+4 -1
website/src/main.rs
··· 1 1 use content::content_sources; 2 - use maudit::{AssetsOptions, BuildOptions, BuildOutput, coronate, routes}; 2 + use maudit::{AssetsOptions, BuildOptions, BuildOutput, PrefetchOptions, coronate, routes}; 3 3 4 4 mod content; 5 5 mod layout; ··· 25 25 assets: AssetsOptions { 26 26 tailwind_binary_path: "../node_modules/.bin/tailwindcss".into(), 27 27 ..Default::default() 28 + }, 29 + prefetch: PrefetchOptions { 30 + strategy: maudit::PrefetchStrategy::Hover, 28 31 }, 29 32 ..Default::default() 30 33 },
website/static/prefetch.mp4

This is a binary file and will not be displayed.