ADD Logo configuration for the header #14
This commit is contained in:
parent
cc1cc4639c
commit
b623e17c5a
5 changed files with 44 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
"""Configuration file for picopaper blog"""
|
"""Configuration file for picopaper blog"""
|
||||||
|
|
||||||
BLOG_TITLE = "picopaper"
|
BLOG_TITLE = "PicoPaper.com"
|
||||||
BLOG_DESCRIPTION = "we like simple."
|
BLOG_DESCRIPTION = "we like simple."
|
||||||
THEME = "default"
|
THEME = "default"
|
||||||
|
|
||||||
|
|
@ -14,3 +14,8 @@ NAVBAR_ITEMS = [
|
||||||
{'text': 'About', 'url': '/about/'}
|
{'text': 'About', 'url': '/about/'}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Logo settings
|
||||||
|
HIDE_LOGO = False
|
||||||
|
HIDE_TITLE = True
|
||||||
|
LOGO_PATH = "/images/logo.png"
|
||||||
|
|
||||||
|
|
|
||||||
BIN
images/logo.png
Normal file
BIN
images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
20
picopaper.py
20
picopaper.py
|
|
@ -6,7 +6,7 @@ from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
import markdown
|
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:
|
class SSGGGenerator:
|
||||||
def __init__(self, items_dir='items', output_dir='output', theme=None, blog_title=None, blog_description=None):
|
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.blog_description = blog_description or BLOG_DESCRIPTION
|
||||||
self.exclude_feeds = EXCLUDE_FEEDS_FROM_MAIN
|
self.exclude_feeds = EXCLUDE_FEEDS_FROM_MAIN
|
||||||
self.navbar_items = NAVBAR_ITEMS
|
self.navbar_items = NAVBAR_ITEMS
|
||||||
|
self.hide_logo = HIDE_LOGO
|
||||||
|
self.hide_title = HIDE_TITLE
|
||||||
|
self.logo_path = LOGO_PATH
|
||||||
|
|
||||||
# Setup Jinja2
|
# Setup Jinja2
|
||||||
self.env = Environment(loader=FileSystemLoader(self.templates_dir))
|
self.env = Environment(loader=FileSystemLoader(self.templates_dir))
|
||||||
|
|
@ -143,7 +146,10 @@ class SSGGGenerator:
|
||||||
blog_description=self.blog_description,
|
blog_description=self.blog_description,
|
||||||
navbar_items=self.navbar_items,
|
navbar_items=self.navbar_items,
|
||||||
posts=posts,
|
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)
|
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
@ -174,7 +180,10 @@ class SSGGGenerator:
|
||||||
blog_description=self.blog_description,
|
blog_description=self.blog_description,
|
||||||
navbar_items=self.navbar_items,
|
navbar_items=self.navbar_items,
|
||||||
feeds=feed_list,
|
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)
|
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
@ -193,7 +202,10 @@ class SSGGGenerator:
|
||||||
blog_description=self.blog_description,
|
blog_description=self.blog_description,
|
||||||
navbar_items=self.navbar_items,
|
navbar_items=self.navbar_items,
|
||||||
post=post,
|
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
|
# Create directory for the post slug
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ header {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
|
@ -22,7 +23,13 @@ hr {
|
||||||
border: 1px solid #efefef;
|
border: 1px solid #efefef;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 { margin: 0; }
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-logo {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
.blog-description {
|
.blog-description {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
|
|
@ -33,6 +40,10 @@ h1 { margin: 0; }
|
||||||
.main-nav {
|
.main-nav {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,14 @@
|
||||||
<header>
|
<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>
|
<p class="blog-description">{{ blog_description }}</p>
|
||||||
<nav class="main-nav">
|
<nav class="main-nav">
|
||||||
{% for item in navbar_items %}
|
{% for item in navbar_items %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue