perf: self-host fonts and add /admin route
Self-hosted fonts: - Download all 10 typefaces (35 font files, 728KB) from Google Fonts - Create @font-face declarations in assets/css/fonts.css - Remove Google Fonts external dependency from layouts - Privacy improvement (no Google tracking) - Performance improvement (no DNS lookup to fonts.googleapis.com) - GDPR compliant (no third-party requests) Admin access: - Add /admin route that redirects to /admin/theme (requires auth) - Remove Admin link from footer (too visible for visitors) - Shop owners can bookmark or type /admin directly Layout improvements: - Create shop_root.html.heex as minimal root for shop pages - Shop pages no longer show admin nav bar Other: - Update .gitignore to exclude digested static files - Add PageSpeed 100% task to ROADMAP.md - Fix test to check /users/settings instead of shop homepage Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,9 +8,6 @@
|
||||
{assigns[:page_title]}
|
||||
</.live_title>
|
||||
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=DM+Sans:opsz,wght@9..40,400..700&family=Fraunces:opsz,wght@9..144,400..700&family=Inter:wght@300..700&family=Manrope:wght@400..700&family=Outfit:wght@300..600&family=Playfair+Display:wght@400;500;700&family=Raleway:wght@300;400;500&family=Source+Serif+4:wght@400;600&family=Space+Grotesk:wght@400..600&family=Work+Sans:wght@300..600&display=swap" rel="stylesheet">
|
||||
<script defer phx-track-static type="text/javascript" src={~p"/assets/js/app.js"}>
|
||||
</script>
|
||||
<script>
|
||||
|
||||
@@ -6,12 +6,6 @@
|
||||
<meta name="csrf-token" content={get_csrf_token()} />
|
||||
<.live_title><%= assigns[:page_title] || @theme_settings.site_name %></.live_title>
|
||||
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=DM+Sans:opsz,wght@9..40,400..700&family=Fraunces:opsz,wght@9..144,400..700&family=Inter:wght@300..700&family=Manrope:wght@400..700&family=Outfit:wght@300..600&family=Playfair+Display:wght@400;500;700&family=Raleway:wght@300;400;500&family=Source+Serif+4:wght@400;600&family=Space+Grotesk:wght@400..600&family=Work+Sans:wght@300..600&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<script defer phx-track-static type="text/javascript" src={~p"/assets/js/app.js"}>
|
||||
</script>
|
||||
<!-- Generated theme CSS (only active values, not all variants) -->
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="h-full">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="csrf-token" content={get_csrf_token()} />
|
||||
<.live_title default="SimpleshopTheme">
|
||||
{assigns[:page_title]}
|
||||
</.live_title>
|
||||
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
|
||||
<script defer phx-track-static type="text/javascript" src={~p"/assets/js/app.js"}>
|
||||
</script>
|
||||
</head>
|
||||
<body class="h-full">
|
||||
{@inner_content}
|
||||
</body>
|
||||
</html>
|
||||
7
lib/simpleshop_theme_web/controllers/admin_controller.ex
Normal file
7
lib/simpleshop_theme_web/controllers/admin_controller.ex
Normal file
@@ -0,0 +1,7 @@
|
||||
defmodule SimpleshopThemeWeb.AdminController do
|
||||
use SimpleshopThemeWeb, :controller
|
||||
|
||||
def index(conn, _params) do
|
||||
redirect(conn, to: ~p"/admin/theme")
|
||||
end
|
||||
end
|
||||
@@ -18,6 +18,7 @@ defmodule SimpleshopThemeWeb.Router do
|
||||
end
|
||||
|
||||
pipeline :shop do
|
||||
plug :put_root_layout, html: {SimpleshopThemeWeb.Layouts, :shop_root}
|
||||
plug SimpleshopThemeWeb.Plugs.LoadTheme
|
||||
end
|
||||
|
||||
@@ -72,6 +73,13 @@ defmodule SimpleshopThemeWeb.Router do
|
||||
|
||||
## Authentication routes
|
||||
|
||||
# /admin redirects to theme editor (requires auth, will redirect to login if needed)
|
||||
scope "/admin", SimpleshopThemeWeb do
|
||||
pipe_through [:browser, :require_authenticated_user]
|
||||
|
||||
get "/", AdminController, :index
|
||||
end
|
||||
|
||||
scope "/", SimpleshopThemeWeb do
|
||||
pipe_through [:browser, :require_authenticated_user]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user