From 1310f4fc294923d2b732e9ff93f125f226fd7c02 Mon Sep 17 00:00:00 2001 From: Florian Briand Date: Tue, 27 Aug 2024 10:56:04 +0200 Subject: [PATCH] docs: add some comments on useful locations --- crates/app/src/lib.rs | 1 + crates/app/src/menu.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/crates/app/src/lib.rs b/crates/app/src/lib.rs index 4abf2a1..1dd9829 100644 --- a/crates/app/src/lib.rs +++ b/crates/app/src/lib.rs @@ -16,5 +16,6 @@ pub fn get_router(assets_path: &Path) -> axum::Router { .nest_service("/assets", ServeDir::new(assets_path)) .merge(pages::get_routes()) .fallback(fallback) + // The AutoVaryLayer is used to avoid cache issues with htmx (cf: https://github.com/robertwayne/axum-htmx?tab=readme-ov-file#auto-caching-management) .layer(AutoVaryLayer) } diff --git a/crates/app/src/menu.rs b/crates/app/src/menu.rs index a3d51ac..2b68cbe 100644 --- a/crates/app/src/menu.rs +++ b/crates/app/src/menu.rs @@ -4,6 +4,9 @@ pub struct MenuItem { pub href: String, } +/// Get the menu items +/// This function is the central place to define the menu items +/// It can be used directly in templates, for example in the `navbar` component to render the menu pub fn get_menu_items() -> Vec { vec![ MenuItem {