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}")
shutil.copyfile(self.image_file, image_targetfile)
self.image_file = f"{self.image_file.stem}.jpg"
else:
self.image_file = False
except Exception as e:
logger.error(f"Couldn't render image file {self.image_file}: {e}")
try:
@@ -45,13 +47,13 @@ class ContentItem:
except Exception as e:
logger.error(f"Couldn't render CSS file {self.css_file}: {e}")
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)
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}")
shutil.copyfile(self.js_file, js_targetfile)
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:
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))