This commit is contained in:
SG
2025-06-16 22:11:24 +03:00
parent 7d81226d83
commit 0583eb07ee
3 changed files with 36 additions and 42 deletions

View File

@@ -47,7 +47,7 @@ class ContentItem:
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)
with self.target_file.open("w", encoding="utf-8") as f: with self.target_file.open("w", encoding="utf-8") as f:
f.write(content_item_template.render(content_item = self, page_title = self.title, parent_path = '../', categories = categories)) f.write(content_item_template.render(content_item = self, page_title = f"{Config.MAIN_PAGE_TITLE}: {self.title}", parent_path = '../', categories = categories))
except Exception as e: except Exception as e:
logger.error(f"Renderer: {e}") logger.error(f"Renderer: {e}")
@@ -175,7 +175,7 @@ class Site:
category_index = Path(f"{self.output_dir}/categories/{category}.html") category_index = Path(f"{self.output_dir}/categories/{category}.html")
category_items = [i for i in visible_content_items if category in i.data.get("categories")] category_items = [i for i in visible_content_items if category in i.data.get("categories")]
with (category_index).open(mode="w", encoding="utf-8") as f: with (category_index).open(mode="w", encoding="utf-8") as f:
f.write(index_template.render(page_title=category, content_items=category_items, categories = self.categories, parent_path = '../')) f.write(index_template.render(page_title=f"{Config.MAIN_PAGE_TITLE}: {category}", content_items=category_items, categories = self.categories, parent_path = '../'))
logger.info(f"Created {len(self.content_items)} content items.") logger.info(f"Created {len(self.content_items)} content items.")

View File

@@ -3,38 +3,29 @@ body {
"Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif,
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
} }
.top_header { .top_header {
position: relative; position: relative;
height: 200px; height: 150px;
background: rgb(70, 70, 124); background: rgb(70, 70, 124);
background-image: url("{{ parent_path }}static/images/header.jpg"); overflow: hidden;
background-size: cover; object-fit: cover;
background-position: center;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
} }
.top_header_text { .top_header_text {
position: absolute; position: absolute;
bottom: 10px; bottom: 0;
left: 10px; left: 0;
color: white; color: rgba(255,255,255,0.75);
font-weight: bold; font-weight: bold;
font-size: 2.5rem; font-size: 1em;
background: rgba(0, 0, 0, 0.05); line-height: 2em;
border-radius: 5px; background: rgba(0, 0, 0, 0.85);
padding: 10px 20px; width: 100%;
border-radius: 10px; text-decoration: none;
} }
/*
@media (min-width: 768px) {
.top_header_text {
font-size: 4rem;
}
}
*/
article { article {
font-size: 1.1rem; font-size: 1.1rem;
line-height: 1.6; line-height: 1.6;

View File

@@ -13,24 +13,27 @@
</head> </head>
<body> <body>
<div class="top_header"> <div id="content">
<div class="col-auto"> <div id= "top_header" class="row top_header">
<h1 class="top_header_text"><a style="border-radius: 5px; padding: 10px; opacity: 0.7; background: black">{{ page_title }}</a></h1> <img id="top_header_image" src="{{ parent_path }}static/images/header.jpg" class="img-fluid">
</div> <div id="top_title" class="row">
</div> <a class="top_header_text">{{ page_title }}</a>
<div class="row justify-content-end pe-2 py-2" > </div>
<div class="col-auto fw-bold">
<a class="link-body-emphasis mx-2 text-decoration-none" href="{{ parent_path }}index.html">Home</a>
<a class="link-body-emphasis mx-2 text-decoration-none" id="categories_toggle" href="#none">Categories</a>
<a class="link-body-emphasis mx-2 text-decoration-none" href="{{ parent_path }}static/about.html">About</a>
<a class="link-body-emphasis mx-2 text-decoration-none" id="dark_theme_toggle" href="#none">🌓︎</a>
</div> </div>
</div> <div id="menu_container" class="row justify-content-end pe-2 py-2" >
<div id="categories_container" class="container"> <div id="menu_wrapper" class="col-auto fw-bold">
<div id="categories_menu" class="row justify-content-center mx-auto mb-2" style="display: none"> <a class="link-body-emphasis mx-2 text-decoration-none" href="{{ parent_path }}index.html">Home</a>
{% for category in categories %} <a class="link-body-emphasis mx-2 text-decoration-none" id="categories_toggle" href="#none">Categories</a>
<a href="{{ parent_path }}categories/{{ category }}.html" class="mx-1 text-decoration-none">{{ category }}</a> <a class="link-body-emphasis mx-2 text-decoration-none" href="{{ parent_path }}static/about.html">About</a>
{% endfor %} <a class="link-body-emphasis mx-2 text-decoration-none" id="dark_theme_toggle" href="#none">🌓︎</a>
</div>
</div>
<div id="categories_container" class="container">
<div id="categories_menu" class="row justify-content-center mx-auto mb-2" style="display: none">
{% for category in categories %}
<a href="{{ parent_path }}categories/{{ category }}.html" class="mx-1 text-decoration-none">{{ category }}</a>
{% endfor %}
</div>
</div> </div>
</div> </div>