From 0fd4214b6c3c22e91a473e9ce68685fe8e9f6cbd Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Sun, 8 Feb 2026 18:07:10 +0000 Subject: [PATCH] refactor(static): prefix all static asset routes with /static/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move static asset URLs from root-level paths to /static/ prefix mirroring the filesystem layout (e.g. /styles.css → /static/css/styles.css, /components/*.js → /static/js/components/*.js). --- src/application/routes/app/mod.rs | 23 +++++++++++++---------- templates/base.html | 16 ++++++++-------- templates/pages/admin.html | 2 +- templates/pages/bag.html | 2 +- templates/pages/brew.html | 2 +- templates/pages/cafe.html | 2 +- templates/pages/cup.html | 2 +- templates/pages/gear.html | 2 +- templates/pages/home.html | 2 +- templates/pages/login.html | 2 +- templates/pages/register.html | 2 +- templates/pages/roast.html | 2 +- templates/pages/roaster.html | 2 +- templates/pages/stats.html | 2 +- templates/partials/nav.html | 2 +- 15 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/application/routes/app/mod.rs b/src/application/routes/app/mod.rs index ea4967c..9402d0e 100644 --- a/src/application/routes/app/mod.rs +++ b/src/application/routes/app/mod.rs @@ -44,19 +44,22 @@ pub(super) fn router() -> axum::Router { "/roasters/{roaster_slug}/roasts/{roast_slug}", get(roasts::roast_detail_page), ) - .route("/styles.css", get(styles)) - .route("/webauthn.js", get(webauthn_js)) - .route("/components/photo-capture.js", get(photo_capture_js)) + .route("/static/css/styles.css", get(styles)) + .route("/static/js/webauthn.js", get(webauthn_js)) .route( - "/components/searchable-select.js", + "/static/js/components/photo-capture.js", + get(photo_capture_js), + ) + .route( + "/static/js/components/searchable-select.js", get(searchable_select_js), ) - .route("/components/chip-scroll.js", get(chip_scroll_js)) - .route("/components/world-map.js", get(world_map_js)) - .route("/components/donut-chart.js", get(donut_chart_js)) - .route("/favicon-light.svg", get(favicon_light)) - .route("/favicon-dark.svg", get(favicon_dark)) - .route("/og-image.png", get(og_image)) + .route("/static/js/components/chip-scroll.js", get(chip_scroll_js)) + .route("/static/js/components/world-map.js", get(world_map_js)) + .route("/static/js/components/donut-chart.js", get(donut_chart_js)) + .route("/static/favicon-light.svg", get(favicon_light)) + .route("/static/favicon-dark.svg", get(favicon_dark)) + .route("/static/og-image.png", get(og_image)) .route("/health", get(health)) } diff --git a/templates/base.html b/templates/base.html index 7923232..35b74a7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -13,8 +13,8 @@ {% block title %}Brewlog{% endblock %} - - + + @@ -30,11 +30,11 @@ type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar@1.0.0-RC.6/bundles/datastar.js" > - - - - - + + + + + {% block head %}{% endblock %} + {% endblock %} {% block content %}
diff --git a/templates/pages/bag.html b/templates/pages/bag.html index 94b95cc..325f3d4 100644 --- a/templates/pages/bag.html +++ b/templates/pages/bag.html @@ -5,7 +5,7 @@ {% block description %}{{ bag.roast_name }} by {{ bag.roaster_name }} — {{ bag.amount }} bag.{% endblock %} {% block og_title %}{{ bag.roast_name }} — Brewlog{% endblock %} {% block og_description %}{{ bag.roast_name }} by {{ bag.roaster_name }} — {{ bag.amount }} bag.{% endblock %} -{% block head %}{% endblock %} +{% block head %}{% endblock %} {% block content %}
diff --git a/templates/pages/brew.html b/templates/pages/brew.html index d880d78..31c7c48 100644 --- a/templates/pages/brew.html +++ b/templates/pages/brew.html @@ -5,7 +5,7 @@ {% block description %}{{ brew.roast_name }} by {{ brew.roaster_name }} — {{ brew.coffee_weight }} coffee, {{ brew.water_volume }} water.{% endblock %} {% block og_title %}{{ brew.roast_name }} — Brewlog{% endblock %} {% block og_description %}{{ brew.roast_name }} by {{ brew.roaster_name }} — {{ brew.coffee_weight }} coffee, {{ brew.water_volume }} water.{% endblock %} -{% block head %}{% endblock %} +{% block head %}{% endblock %} {% block content %}
diff --git a/templates/pages/cafe.html b/templates/pages/cafe.html index 7553f24..78251b5 100644 --- a/templates/pages/cafe.html +++ b/templates/pages/cafe.html @@ -4,7 +4,7 @@ {% block title %}Brewlog · {{ cafe.name }}{% endblock %} {% block og_title %}{{ cafe.name }} — Brewlog{% endblock %} {% block og_description %}{{ cafe.name }} — {{ cafe.city }}, {{ cafe.country_flag }} {{ cafe.country }}{% endblock %} -{% block head %}{% endblock %} +{% block head %}{% endblock %} {% block content %}
diff --git a/templates/pages/cup.html b/templates/pages/cup.html index cf6fa4d..ae0464c 100644 --- a/templates/pages/cup.html +++ b/templates/pages/cup.html @@ -5,7 +5,7 @@ {% block description %}{{ cup.roast_name }} by {{ cup.roaster_name }} at {{ cup.cafe_name }}, {{ cup.cafe_city }}.{% endblock %} {% block og_title %}{{ cup.roast_name }} at {{ cup.cafe_name }} — Brewlog{% endblock %} {% block og_description %}{{ cup.roast_name }} by {{ cup.roaster_name }} at {{ cup.cafe_name }}, {{ cup.cafe_city }}.{% endblock %} -{% block head %}{% endblock %} +{% block head %}{% endblock %} {% block content %}
diff --git a/templates/pages/gear.html b/templates/pages/gear.html index b9b5d47..f4c99cf 100644 --- a/templates/pages/gear.html +++ b/templates/pages/gear.html @@ -3,7 +3,7 @@ {% block title %}Brewlog · {{ gear.make }} {{ gear.model }}{% endblock %} {% block og_title %}{{ gear.make }} {{ gear.model }} — Brewlog{% endblock %} {% block og_description %}{{ gear.make }} {{ gear.model }} — {{ gear.category_label }}{% endblock %} -{% block head %}{% endblock %} +{% block head %}{% endblock %} {% block content %}
diff --git a/templates/pages/home.html b/templates/pages/home.html index a7e90fa..d32b48a 100644 --- a/templates/pages/home.html +++ b/templates/pages/home.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% import "partials/bag_card.html" as bag_card %} {% import "partials/brew_card.html" as brew_card %} {% import "partials/icons.html" as icons %} {% block title %}Brewlog{% endblock %} {% block head %} - + {% endblock %} {% block content %} {% if is_authenticated %} diff --git a/templates/pages/login.html b/templates/pages/login.html index 86ef26f..310ac52 100644 --- a/templates/pages/login.html +++ b/templates/pages/login.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% import "partials/icons.html" as icons %} {% block title %}Brewlog · Login{% endblock %} {% block head %} - + {% endblock %} {% block content %}
diff --git a/templates/pages/register.html b/templates/pages/register.html index 0002aac..670efa9 100644 --- a/templates/pages/register.html +++ b/templates/pages/register.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% import "partials/icons.html" as icons %} {% block title %}Brewlog · Register{% endblock %} {% block head %} - + {% endblock %} {% block content %}
diff --git a/templates/pages/roast.html b/templates/pages/roast.html index f4113ef..3aa46f3 100644 --- a/templates/pages/roast.html +++ b/templates/pages/roast.html @@ -4,7 +4,7 @@ {% block title %}Brewlog · {{ roast.name }}{% endblock %} {% block og_title %}{{ roast.name }} — Brewlog{% endblock %} {% block og_description %}{{ roast.name }} by {{ roast.roaster_name }} — {{ roast.origin }}{% endblock %} -{% block head %}{% endblock %} +{% block head %}{% endblock %} {% block content %}
diff --git a/templates/pages/roaster.html b/templates/pages/roaster.html index 82c1726..1c326b4 100644 --- a/templates/pages/roaster.html +++ b/templates/pages/roaster.html @@ -4,7 +4,7 @@ {% block title %}Brewlog · {{ roaster.name }}{% endblock %} {% block og_title %}{{ roaster.name }} — Brewlog{% endblock %} {% block og_description %}{{ roaster.name }} — {{ roaster.country_flag }} {{ roaster.country }}{% if let Some(c) = roaster.city %}, {{ c }}{% endif %}{% endblock %} -{% block head %}{% endblock %} +{% block head %}{% endblock %} {% block content %}
diff --git a/templates/pages/stats.html b/templates/pages/stats.html index 6c29838..64b2c00 100644 --- a/templates/pages/stats.html +++ b/templates/pages/stats.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% import "partials/icons.html" as icons %} {% import "partials/histogram.html" as histogram %} {% block title %}Brewlog · Stats{% endblock %} {% block og_title %}Stats — Brewlog{% endblock %} {% block og_description %}Aggregated coffee data across origins, consumption, and brewing.{% endblock %} -{% block head %}{% endblock %} +{% block head %}{% endblock %} {% block content %}
diff --git a/templates/partials/nav.html b/templates/partials/nav.html index ce9bff7..af76380 100644 --- a/templates/partials/nav.html +++ b/templates/partials/nav.html @@ -52,7 +52,7 @@ }); const favicon = document.getElementById("favicon"); if (favicon) { - favicon.href = isDark ? "/favicon-dark.svg" : "/favicon-light.svg"; + favicon.href = isDark ? "/static/favicon-dark.svg" : "/static/favicon-light.svg"; } };