Rust library to generate static websites
5
fork

Configure Feed

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

fix: indent

+16 -16
+16 -16
website/content/docs/routing.md
··· 172 172 use maudit::route::prelude::*; 173 173 174 174 #[route( 175 - "/contact", 176 - locales(sv(prefix = "/sv"), de(path = "/de/kontakt")) 175 + "/contact", 176 + locales(sv(prefix = "/sv"), de(path = "/de/kontakt")) 177 177 )] 178 178 pub struct Contact; 179 179 180 180 impl Route for Contact { 181 - fn render(&self, ctx: &mut PageContext) -> impl Into<RenderResult> { 182 - match &ctx.variant { 183 - Some(language) => match language.as_str() { 184 - "sv" => "Kontakta oss.", 185 - "de" => "Kontaktieren Sie uns.", 186 - _ => unreachable!(), 187 - }, 188 - _ => "Contact us.", 189 - } 181 + fn render(&self, ctx: &mut PageContext) -> impl Into<RenderResult> { 182 + match &ctx.variant { 183 + Some(language) => match language.as_str() { 184 + "sv" => "Kontakta oss.", 185 + "de" => "Kontaktieren Sie uns.", 186 + _ => unreachable!(), 187 + }, 188 + _ => "Contact us.", 190 189 } 190 + } 191 191 } 192 192 ``` 193 193 ··· 210 210 pub struct Redirect; 211 211 212 212 impl Route for Redirect { 213 - fn render(&self, ctx: &mut PageContext) -> impl Into<RenderResult> { 214 - redirect("https://example.com") 213 + fn render(&self, ctx: &mut PageContext) -> impl Into<RenderResult> { 214 + redirect("https://example.com") 215 215 216 - // Use a page's url method to generate type safe links: 217 - // redirect(&OtherPage.url(None)) 218 - } 216 + // Use a page's url method to generate type safe links: 217 + // redirect(&OtherPage.url(None)) 218 + } 219 219 } 220 220 ``` 221 221