From cfe8e9a7996a277ebbdcb2a3da9ebc1ae52c9823 Mon Sep 17 00:00:00 2001 From: SG Date: Mon, 16 Jun 2025 17:55:58 +0300 Subject: [PATCH] updates --- classes.py | 2 +- .../{static/images => content}/about.jpg | Bin themes/default/content/about.md | 9 ++++++++ themes/default/static/about.md | 5 ----- themes/default/static/js/theme.js | 20 ++++++++++++++++++ themes/default/templates/content_item.html | 2 +- themes/default/templates/default.html | 19 +---------------- 7 files changed, 32 insertions(+), 25 deletions(-) rename themes/default/{static/images => content}/about.jpg (100%) create mode 100644 themes/default/content/about.md delete mode 100644 themes/default/static/about.md create mode 100644 themes/default/static/js/theme.js diff --git a/classes.py b/classes.py index df9beac..c1b105c 100644 --- a/classes.py +++ b/classes.py @@ -160,7 +160,7 @@ class Site: content_item.render_content(categories = self.categories) # Render the about file - about_content = ContentItem(Path(f'themes/{Config.THEME}/static/about.md')) + about_content = ContentItem(Path(f'themes/{Config.THEME}/content/about.md')) about_content.parse_content() about_content.render_content(categories = self.categories, target_file='public/static/about.html') diff --git a/themes/default/static/images/about.jpg b/themes/default/content/about.jpg similarity index 100% rename from themes/default/static/images/about.jpg rename to themes/default/content/about.jpg diff --git a/themes/default/content/about.md b/themes/default/content/about.md new file mode 100644 index 0000000..553e56e --- /dev/null +++ b/themes/default/content/about.md @@ -0,0 +1,9 @@ +--- +title: "About" +omit_second_title: True +--- + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \ No newline at end of file diff --git a/themes/default/static/about.md b/themes/default/static/about.md deleted file mode 100644 index 5d85d31..0000000 --- a/themes/default/static/about.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "About" -omit_second_title: True ---- - diff --git a/themes/default/static/js/theme.js b/themes/default/static/js/theme.js new file mode 100644 index 0000000..b0c2575 --- /dev/null +++ b/themes/default/static/js/theme.js @@ -0,0 +1,20 @@ +console.log('Default theme loaded.') + +const saved_color_theme = localStorage.getItem('saved_color_theme'); + +if (saved_color_theme) { +document.documentElement.setAttribute('data-bs-theme', saved_color_theme); +} + +document.getElementById("categories_toggle").onclick = function() { +categories_menu_item = document.getElementById("categories_menu"); +categories_menu_item.style.display = categories_menu_item.style.display === "none" ? "block" : "none" +} + +document.getElementById("dark_theme_toggle").onclick = function() { +html = document.documentElement; +current_color_theme = html.getAttribute('data-bs-theme'); +new_color_theme = current_color_theme === 'dark' ? 'light' : 'dark'; +html.setAttribute('data-bs-theme', new_color_theme); +localStorage.setItem('saved_color_theme', new_color_theme); +} \ No newline at end of file diff --git a/themes/default/templates/content_item.html b/themes/default/templates/content_item.html index 97123a8..7e37f47 100644 --- a/themes/default/templates/content_item.html +++ b/themes/default/templates/content_item.html @@ -9,7 +9,7 @@ {% block content %}
- {% if content_item.image_file %}{% endif %} + {% if not content_item.omit_second_title %}

{{ content_item.title }}

{% endif %} diff --git a/themes/default/templates/default.html b/themes/default/templates/default.html index c985175..67a220e 100644 --- a/themes/default/templates/default.html +++ b/themes/default/templates/default.html @@ -93,22 +93,5 @@
- +