diff --git a/tuftecms/blueprints/content.py b/tuftecms/blueprints/content.py index 1efcee5..b89e206 100644 --- a/tuftecms/blueprints/content.py +++ b/tuftecms/blueprints/content.py @@ -449,6 +449,10 @@ def serve_content(path): # Get title from directory name title = path.split("/")[-1].replace("-", " ").replace("_", " ").title() + # Generate folder icon for this directory + from ..utils.content import generate_folder_icon + folder_icon = generate_folder_icon(title, size=32) + return render_template( "directory.html", items=items, @@ -458,6 +462,7 @@ def serve_content(path): title=title, is_image_gallery=is_image_gallery, image_items=image_items, + folder_icon=folder_icon, ) # Handle markdown files diff --git a/tuftecms/templates/directory.html b/tuftecms/templates/directory.html index 7ff4499..e642f44 100644 --- a/tuftecms/templates/directory.html +++ b/tuftecms/templates/directory.html @@ -381,12 +381,34 @@ body.dark-mode .parent-link:hover { color: #ccc; } } + +/* Directory title icon */ +.directory-title-icon { + width: 32px; + height: 32px; + margin-right: 0.5rem; + vertical-align: middle; + display: inline-block; +} + +@media (max-width: 760px) { + .directory-title-icon { + width: 24px; + height: 24px; + margin-right: 0.4rem; + } +} {% endblock %} {% block content %} {% if current_path and current_path != '' %} -

{{ current_path.split('/')[-1] if '/' in current_path else current_path }}

+

+ {% if folder_icon %} + Folder icon + {% endif %} + {{ current_path.split('/')[-1] if '/' in current_path else current_path }} +

{% endif %} {% if index_content and content_position == 'top' %}