diff --git a/district/jekyll_import.py b/district/jekyll_import.py index 743524f2064efa40afcd729aa5911e3546d6ff01..f3697003442e3b8e64675ae111e121ef15204037 100644 --- a/district/jekyll_import.py +++ b/district/jekyll_import.py @@ -3,6 +3,7 @@ import re import urllib import xml.etree.ElementTree as ET import zipfile +from datetime import date from io import StringIO from shutil import rmtree from sys import stdout @@ -104,9 +105,15 @@ def import_post(path, file_path, parent, title_suffix, dry_run): article.text = html article.perex = get_perex(md) - article.date = meta["date"].split()[0] + + meta_date = meta["date"] + if isinstance(meta_date, date): + article.date = meta_date + else: + article.date = meta["date"].split()[0] + article.title = meta["title"] - article.author = meta["author"] + article.author = meta.get("author", "Česká pirátská strana") article.seo_title = article.title + title_suffix article.search_description = meta.get("description", "") @@ -217,7 +224,7 @@ def perform_import( site_config = get_site_config(path) title_suffix = get_title_from_site_config(site_config) - articlepath = site_config["articlepath"] + articlepath = site_config.get("articlepath", "aktuality") for fn in os.listdir(os.path.join(path, POSTS_DIR)): fname = os.path.join(POSTS_DIR, fn)