diff --git a/classes.py b/classes.py
index d2434fe..d158113 100644
--- a/classes.py
+++ b/classes.py
@@ -16,31 +16,36 @@ class ContentItem:
shutil.copyfile(self.image_file, Path(Config.OUTPUT_DIR) / self.image_file)
self.image_file = f"{self.image_file.stem}.jpg"
if self.css_file and self.css_file.exists():
- shutil.copyfile(self.css_file,Path(Config.OUTPUT_DIR) / self.css_file)
+ css_targetfile = Path(f"{Config.OUTPUT_DIR}/{Config.STATIC_DIR}/css/{self.css_file.name}")
+ logger.debug(f"Copying {self.css_file} to {css_targetfile}")
+ shutil.copyfile(self.css_file, css_targetfile)
+ self.css_file = css_targetfile
if self.js_file and self.js_file.exists():
shutil.copyfile(self.js_file, Path(Config.OUTPUT_DIR) / self.js_file)
with self.target_filename.open("w", encoding="utf-8") as f:
f.write(content_item_template.render(content_item = self, page_title = self.title))
def parse_content(self):
+ logger.debug(f"Parsing file {self.source_filename}")
try:
self.source_filename = Path(self.source_filename)
- logger.debug(f"Parsing item {self.source_filename}")
self.subdir = self.source_filename.parent
self.slug = self.source_filename.stem
self.target_filename = Path(f"{Config.OUTPUT_DIR}/{self.source_filename.parent}/{self.source_filename.stem}.html")
self.data = frontmatter.load(self.source_filename)
- self.html = markdown.markdown(self.data.content.replace('\n', ' \n'))
self.url = " ...read more"
- self.preview = self.html[:300] + self.url
+ self.preview = self.data.content.replace('\n', '
')[:300] + self.url
self.title = self.data.get("title", self.slug)
self.omit_second_title = self.data.get("omit_second_title", False)
self.date = self.data.get("date", "2000-01-01T00:00:00+03:00")
self.categories = self.data.get("categories", str([]))
self.hidden = self.data.get("hidden", str(False))
+ self.data.content = self.data.content.replace('\n', ' \n')
+ self.html = markdown.markdown(self.data.content)
cover_image_path = Path(self.source_filename.parent) / Path(self.source_filename.stem + ".jpg")
self.image_file = cover_image_path if cover_image_path.exists() else None
- self.css_file = Path(self.source_filename.stem + ".css") if Path(self.source_filename.stem + ".css").exists() else None
+ css_filepath = Path(f"{self.source_filename.parent}/{self.source_filename.stem}.css")
+ self.css_file = css_filepath if css_filepath.exists() else None
self.js_file = Path(self.source_filename.stem + ".js") if Path(self.source_filename.stem + ".js").exists else None
except Exception as e:
logger.error(e)
diff --git a/config.py b/config.py
index 24dd35f..3cd1cea 100644
--- a/config.py
+++ b/config.py
@@ -10,4 +10,5 @@ class Config:
TEMPLATES_DIR = 'templates'
CONTENT_DIR = 'content'
STATIC_DIR = 'static'
- HEADER_IMAGE = 'static/header.jpg'
\ No newline at end of file
+ HEADER_IMAGE = 'static/header.jpg'
+ THEME = "default"
\ No newline at end of file
diff --git a/static/images/1x1.png b/static/images/1x1.png
new file mode 100644
index 0000000..1914264
Binary files /dev/null and b/static/images/1x1.png differ
diff --git a/static/images/1x1.png.1 b/static/images/1x1.png.1
new file mode 100644
index 0000000..1914264
Binary files /dev/null and b/static/images/1x1.png.1 differ
diff --git a/templates/content_item.html b/templates/content_item.html
index b45666f..49c35a4 100644
--- a/templates/content_item.html
+++ b/templates/content_item.html
@@ -2,8 +2,8 @@
{% extends "default.html" %}
{% block head_includes %}
- {% if content_item.custom_css %}
-
+ {% if content_item.css_file %}
+
{% endif %}
{% endblock %}
diff --git a/templates/default.html b/templates/default.html
index 0f171fb..470ef39 100644
--- a/templates/default.html
+++ b/templates/default.html
@@ -12,7 +12,7 @@
position: relative;
height: 250px;
background: rgb(70, 70, 124);
- background-image: url("{{ header_image }}");
+ background-image: url("/public/static/header.jpg");
background-size: cover;
background-position: center;
display: flex;
@@ -63,10 +63,10 @@
font-size: 1.1rem;
line-height: 1.6;
}
+
{% block head_includes %}
{% endblock %}
-
-
+
+ {% endif %}
{{ content_item.preview | safe}}