Fixed RSS integration and added `header` configuration option

This commit is contained in:
Fabio Manganiello 2022-01-12 21:47:53 +01:00
parent 4a3cd0a88a
commit b256238d45
5 changed files with 16 additions and 4 deletions

View File

@ -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.

View File

@ -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

View File

@ -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'))

View File

@ -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', [])

View File

@ -16,12 +16,14 @@
<title>{{ title }}</title>
</head>
<body>
{% if not skip_header %}
{% if not skip_header and config.header %}
<header>
<div class="left">
{% if config.logo %}
<a href="{{ config.home_link }}" title="Home">
<img src="{{ config.logo }}" class="icon" alt=".">
<img src="{{ config.logo }}" class="icon" alt="">
</a>
{% endif %}
<a href="{{ config.link }}" title="{{ config.title }}">
<span class="title">{{ config.title }}</span>