Add a favicon

Simple SVG icon matching the app's look: a link/chain glyph in white
on the indigo accent color, same rounded-square shape as the card
avatars. Mounts a new /static route via StaticFiles and references it
from base.html's <head>.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Erik Thiele
2026-07-31 12:14:37 +02:00
parent 604c4ea9c2
commit af65171d87
3 changed files with 14 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ from urllib.parse import quote, urlparse
from fastapi import Depends, FastAPI, File, Form, Request, UploadFile
from fastapi.responses import HTMLResponse, RedirectResponse, Response
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
from markupsafe import Markup
from sqlalchemy import func, select, text
@@ -45,6 +46,9 @@ if config.DATABASE_URL.startswith("sqlite"):
app = FastAPI(title="LinkVault")
app.add_middleware(SessionMiddleware, secret_key=config.SECRET_KEY, max_age=60 * 60 * 24 * 14)
app.mount(
"/static", StaticFiles(directory=str(Path(__file__).parent / "static")), name="static"
)
templates = Jinja2Templates(directory=str(Path(__file__).parent / "templates"))
templates.env.globals.update(

9
app/static/favicon.svg Normal file
View File

@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<rect width="32" height="32" rx="8" fill="#6366f1"/>
<g transform="translate(6,6)" fill="none" stroke="#ffffff" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<path d="M9 17H7A5 5 0 0 1 7 7h2"/>
<path d="M15 7h2a5 5 0 1 1 0 10h-2"/>
<line x1="8" y1="12" x2="16" y2="12"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 386 B

View File

@@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}LinkVault{% endblock %}</title>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
<script>
/* Theme so früh wie möglich setzen, damit die Seite nicht kurz hell aufblitzt. */
(function () {