This commit is contained in:
SG
2025-06-30 20:57:01 +03:00
parent 162b45809b
commit 808aab3609
2 changed files with 5 additions and 3 deletions

View File

@@ -25,6 +25,8 @@ class ContentItem:
logger.debug(f"Copying {self.image_file} to {image_targetfile}") logger.debug(f"Copying {self.image_file} to {image_targetfile}")
shutil.copyfile(self.image_file, image_targetfile) shutil.copyfile(self.image_file, image_targetfile)
self.image_file = f"{self.image_file.stem}.jpg" self.image_file = f"{self.image_file.stem}.jpg"
else:
self.image_file = False
except Exception as e: except Exception as e:
logger.error(f"Couldn't render image file {self.image_file}: {e}") logger.error(f"Couldn't render image file {self.image_file}: {e}")
try: try:
@@ -45,13 +47,13 @@ class ContentItem:
except Exception as e: except Exception as e:
logger.error(f"Couldn't render CSS file {self.css_file}: {e}") logger.error(f"Couldn't render CSS file {self.css_file}: {e}")
try: try:
if self.js_file and self.js_file.exists(): if self.js_file and Path(self.js_file).exists():
self.js_file = Path(self.js_file) self.js_file = Path(self.js_file)
js_targetfile = Path(f"{config.output_dir}/{config.static_dir}/js/{self.js_file.name}") js_targetfile = Path(f"{config.output_dir}/{config.static_dir}/js/{self.js_file.name}")
logger.debug(f"Copying {self.js_file} to {js_targetfile}") logger.debug(f"Copying {self.js_file} to {js_targetfile}")
shutil.copyfile(self.js_file, js_targetfile) shutil.copyfile(self.js_file, js_targetfile)
except Exception as e: except Exception as e:
logger.error(f"Couldn't render CSS file {self.js_file}: {e}") logger.error(f"Couldn't render JS file {self.js_file}: {e}")
try: try:
with self.target_file.open("w", encoding="utf-8") as f: with self.target_file.open("w", encoding="utf-8") as f:
f.write(config.content_item_template.render(content_item = self, page_title = f"{config.site_name}: {self.title}", parent_path = '../', categories = categories, footer_data = footer_data)) f.write(config.content_item_template.render(content_item = self, page_title = f"{config.site_name}: {self.title}", parent_path = '../', categories = categories, footer_data = footer_data))

View File

@@ -10,7 +10,7 @@
{% block content %} {% block content %}
<div class="container mt-4 mb-5"> <div class="container mt-4 mb-5">
{% if content_item.image_file %} {% if content_item.image_file %}
<img src="{{ parent_path }}static/images/{{ content_item.image_file }}" alt = "content_item.image_file" class="img-fluid mb-5 rounded w-100 h-auto"> <img src="{{ parent_path }}static/images/{{ content_item.image_file }}" alt="{{ content_item.image_file }}" class="img-fluid mb-5 rounded w-100 h-auto dotr">
{% endif %} {% endif %}
{% if not content_item.omit_second_title %} {% if not content_item.omit_second_title %}
<h1>{{ content_item.title }}</h1> <h1>{{ content_item.title }}</h1>