load custom css from /static/custom

This commit is contained in:
slonkazoid 2024-08-03 10:19:35 +03:00
parent 2a4bef84b1
commit e3bfa2f53f
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM
4 changed files with 22 additions and 0 deletions

View file

@ -166,6 +166,22 @@ standard. examples of valid and invalid dates:
- # everything else is also invalid - # everything else is also invalid
``` ```
## Custom Content (CSS, HTML, JS)
though you can modify the content and commit it so you still get changes from
upstream with minimal problems.
you can edit the css and js however you want but changing the html requires a
recompilation as it is made from compile-time parsed templates.
bingus-blog currently loads css files from `/static/custom`:
- `/static/custom/style.css` for all pages
- `/static/custom/post.css` for posts
- `/static/custom/error.css` for the error page
you can create a `custom` directory inside the `static_dir` you set in the
config and put the css files there.
## Routes ## Routes
- `GET /`: index page, lists posts - `GET /`: index page, lists posts

View file

@ -5,6 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>error</title> <title>error</title>
<link rel="stylesheet" href="/static/style.css" /> <link rel="stylesheet" href="/static/style.css" />
<link rel="stylesheet" href="/static/custom/style.css" />
<link rel="stylesheet" href="/static/custom/error.css" />
</head> </head>
<body> <body>
<main> <main>

View file

@ -12,6 +12,8 @@
{% when None %} {% endmatch %} {% when None %} {% endmatch %}
<title>{{ title }}</title> <title>{{ title }}</title>
<link rel="stylesheet" href="/static/style.css" /> <link rel="stylesheet" href="/static/style.css" />
<link rel="stylesheet" href="/static/custom/style.css" />
<link rel="stylesheet" href="/static/custom/index.css" />
{% if rss %} {% if rss %}
<link rel="alternate" type="application/rss+xml" title="{{ title }}" href="/feed.xml" /> <link rel="alternate" type="application/rss+xml" title="{{ title }}" href="/feed.xml" />
{% endif %} {% endif %}

View file

@ -31,6 +31,8 @@
<title>{{ meta.title }}</title> <title>{{ meta.title }}</title>
<link rel="stylesheet" href="/static/style.css" /> <link rel="stylesheet" href="/static/style.css" />
<link rel="stylesheet" href="/static/post.css" /> <link rel="stylesheet" href="/static/post.css" />
<link rel="stylesheet" href="/static/custom/style.css" />
<link rel="stylesheet" href="/static/custom/post.css" />
{% if js %} {% if js %}
<script src="/static/date.js" defer></script> <script src="/static/date.js" defer></script>
<script src="/static/main.js" defer></script> <script src="/static/main.js" defer></script>