From b256238d45a15971f63c1dcf676311c7613f24e6 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 12 Jan 2022 21:47:53 +0100 Subject: [PATCH] Fixed RSS integration and added `header` configuration option --- CHANGELOG.md | 5 +++++ README.md | 2 ++ madblog/app.py | 4 ++-- madblog/config.py | 3 +++ madblog/templates/common-head.html | 6 ++++-- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 689eb9e..11d67aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.1.2 + +- Fixed RSS feed support. +- Added `header` configuration option (the blog header can now be removed). + # 0.1.1 First usable version, with several bug fixes and better documentation. diff --git a/README.md b/README.md index 88e93ae..c4b9a58 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ home_link: https://link.to.home logo: /path/or/url/here # Blog language (for the RSS feed) language: en-US +# Show/hide the header (default: true) +header: true categories: - category1 diff --git a/madblog/app.py b/madblog/app.py index 01fe535..15a09be 100644 --- a/madblog/app.py +++ b/madblog/app.py @@ -86,8 +86,8 @@ class BlogApp(Flask): def get_pages(self, with_content: bool = False, skip_header: bool = False) -> list: return sorted([ { - 'path': path, - 'content': self.get_page(path, skip_header=skip_header) if with_content else '', + 'path': path[len(app.pages_dir)+1:], + 'content': self.get_page(path[len(app.pages_dir)+1:], skip_header=skip_header) if with_content else '', **self.get_page_metadata(os.path.basename(path)), } for path in glob(os.path.join(app.pages_dir, '*.md')) diff --git a/madblog/config.py b/madblog/config.py index 13853e0..83ef4a0 100644 --- a/madblog/config.py +++ b/madblog/config.py @@ -12,6 +12,7 @@ class Config: home_link = '/' language = 'en-US' logo = '/img/icon.png' + header = True content_dir = None categories = None @@ -46,6 +47,8 @@ def init_config(content_dir='.', config_file='config.yaml'): config.logo = cfg['logo'] if cfg.get('language'): config.language = cfg['language'] + if cfg.get('header') is False: + config.header = False config.categories = cfg.get('categories', []) diff --git a/madblog/templates/common-head.html b/madblog/templates/common-head.html index 07857b1..4bdbb27 100644 --- a/madblog/templates/common-head.html +++ b/madblog/templates/common-head.html @@ -16,12 +16,14 @@ {{ title }} - {% if not skip_header %} + {% if not skip_header and config.header %}
+ {% if config.logo %} - . + + {% endif %} {{ config.title }}