Compare commits
No commits in common. "69347dde9a4d3c3233d5e39a0e01c041f4556d95" and "cc1cc4639cd4d1fd45afe7deb4245f62422f044b" have entirely different histories.
69347dde9a
...
cc1cc4639c
6 changed files with 7 additions and 48 deletions
|
|
@ -1,7 +1,3 @@
|
||||||
<p align="center">
|
|
||||||
<img src="images/logo.png" alt="picopaper" width="150">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
# picopaper
|
# picopaper
|
||||||
|
|
||||||
A minimal static site generator for blogs built with Python 3 and Jinja2
|
A minimal static site generator for blogs built with Python 3 and Jinja2
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""Configuration file for picopaper blog"""
|
"""Configuration file for picopaper blog"""
|
||||||
|
|
||||||
BLOG_TITLE = "PicoPaper.com"
|
BLOG_TITLE = "picopaper"
|
||||||
BLOG_DESCRIPTION = "we like simple."
|
BLOG_DESCRIPTION = "we like simple."
|
||||||
THEME = "default"
|
THEME = "default"
|
||||||
|
|
||||||
|
|
@ -14,8 +14,3 @@ 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
BIN
images/logo.png
Binary file not shown.
|
Before 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, HIDE_LOGO, HIDE_TITLE, LOGO_PATH
|
from config import BLOG_TITLE, BLOG_DESCRIPTION, THEME, EXCLUDE_FEEDS_FROM_MAIN, NAVBAR_ITEMS
|
||||||
|
|
||||||
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,9 +20,6 @@ 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))
|
||||||
|
|
@ -146,10 +143,7 @@ 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)
|
||||||
|
|
@ -180,10 +174,7 @@ 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)
|
||||||
|
|
@ -202,10 +193,7 @@ 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,7 +12,6 @@ header {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
|
@ -23,13 +22,7 @@ hr {
|
||||||
border: 1px solid #efefef;
|
border: 1px solid #efefef;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 { margin: 0; }
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-logo {
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blog-description {
|
.blog-description {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
|
|
@ -40,10 +33,6 @@ h1 {
|
||||||
.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,14 +1,5 @@
|
||||||
<header>
|
<header>
|
||||||
<h1>
|
<h1><a href="/" style="color: #333; text-decoration: none;">{{ blog_title }}</a></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