ADD Logo configuration for the header #14

This commit is contained in:
Caffeine Fueled 2025-10-23 23:44:24 +02:00
parent cc1cc4639c
commit b623e17c5a
Signed by: cf7
GPG key ID: CA295D643074C68C
5 changed files with 44 additions and 7 deletions

View file

@ -1,6 +1,6 @@
"""Configuration file for picopaper blog"""
BLOG_TITLE = "picopaper"
BLOG_TITLE = "PicoPaper.com"
BLOG_DESCRIPTION = "we like simple."
THEME = "default"
@ -14,3 +14,8 @@ NAVBAR_ITEMS = [
{'text': 'About', 'url': '/about/'}
]
# Logo settings
HIDE_LOGO = False
HIDE_TITLE = True
LOGO_PATH = "/images/logo.png"

BIN
images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -6,7 +6,7 @@ from datetime import datetime
from pathlib import Path
from jinja2 import Environment, FileSystemLoader
import markdown
from config import BLOG_TITLE, BLOG_DESCRIPTION, THEME, EXCLUDE_FEEDS_FROM_MAIN, NAVBAR_ITEMS
from config import BLOG_TITLE, BLOG_DESCRIPTION, THEME, EXCLUDE_FEEDS_FROM_MAIN, NAVBAR_ITEMS, HIDE_LOGO, HIDE_TITLE, LOGO_PATH
class SSGGGenerator:
def __init__(self, items_dir='items', output_dir='output', theme=None, blog_title=None, blog_description=None):
@ -20,6 +20,9 @@ class SSGGGenerator:
self.blog_description = blog_description or BLOG_DESCRIPTION
self.exclude_feeds = EXCLUDE_FEEDS_FROM_MAIN
self.navbar_items = NAVBAR_ITEMS
self.hide_logo = HIDE_LOGO
self.hide_title = HIDE_TITLE
self.logo_path = LOGO_PATH
# Setup Jinja2
self.env = Environment(loader=FileSystemLoader(self.templates_dir))
@ -143,7 +146,10 @@ class SSGGGenerator:
blog_description=self.blog_description,
navbar_items=self.navbar_items,
posts=posts,
all_posts=all_posts or posts
all_posts=all_posts or posts,
hide_logo=self.hide_logo,
hide_title=self.hide_title,
logo_path=self.logo_path
)
output_path.parent.mkdir(parents=True, exist_ok=True)
@ -174,7 +180,10 @@ class SSGGGenerator:
blog_description=self.blog_description,
navbar_items=self.navbar_items,
feeds=feed_list,
all_posts=all_posts or []
all_posts=all_posts or [],
hide_logo=self.hide_logo,
hide_title=self.hide_title,
logo_path=self.logo_path
)
output_path.parent.mkdir(parents=True, exist_ok=True)
@ -193,7 +202,10 @@ class SSGGGenerator:
blog_description=self.blog_description,
navbar_items=self.navbar_items,
post=post,
all_posts=all_posts or []
all_posts=all_posts or [],
hide_logo=self.hide_logo,
hide_title=self.hide_title,
logo_path=self.logo_path
)
# Create directory for the post slug

View file

@ -12,6 +12,7 @@ header {
padding: 20px;
margin-bottom: 40px;
border-radius: 10px;
text-align: center;
}
img {
@ -22,7 +23,13 @@ hr {
border: 1px solid #efefef;
}
h1 { margin: 0; }
h1 {
margin: 0;
}
.header-logo {
vertical-align: middle;
}
.blog-description {
margin: 10px 0 0 0;
@ -33,6 +40,10 @@ h1 { margin: 0; }
.main-nav {
margin-top: 15px;
font-weight: bold;
display: flex;
justify-content: center;
gap: 10px;
flex-wrap: wrap;
}
.nav-item {

View file

@ -1,5 +1,14 @@
<header>
<h1><a href="/" style="color: #333; text-decoration: none;">{{ blog_title }}</a></h1>
<h1>
<a href="/" style="color: #333; text-decoration: none;">
{% if not hide_logo %}
<img src="{{ logo_path }}" alt="{{ blog_title }}" class="header-logo">
{% endif %}
{% if not hide_title %}
{{ blog_title }}
{% endif %}
</a>
</h1>
<p class="blog-description">{{ blog_description }}</p>
<nav class="main-nav">
{% for item in navbar_items %}