Improve HTML output and SEO title tags

- Add Jinja2 whitespace control (trim_blocks, lstrip_blocks) to
  eliminate excessive newlines in rendered HTML output
- Reverse title tag order to "Page - Brand" for better SEO (specific
  content first, brand name second to avoid truncation)
- Add dynamic titles for node detail pages using node name
- Standardize UI text: Dashboard, Advertisements, Map, Members
- Remove refresh button from dashboard page

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Louis King
2026-02-08 21:40:19 +00:00
parent 6b1b277c6c
commit c540e15432
14 changed files with 21 additions and 24 deletions

View File

@@ -123,8 +123,10 @@ def create_app(
network_welcome_text or settings.network_welcome_text
)
# Set up templates
# Set up templates with whitespace control
templates = Jinja2Templates(directory=str(TEMPLATES_DIR))
templates.env.trim_blocks = True # Remove first newline after block tags
templates.env.lstrip_blocks = True # Remove leading whitespace before block tags
app.state.templates = templates
# Initialize page loader for custom markdown pages

View File

@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% from "macros/icons.html" import icon_lock %}
{% block title %}{{ network_name }} - Access Denied{% endblock %}
{% block title %}Access Denied - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex flex-col items-center justify-center min-h-[50vh]">

View File

@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% from "macros/icons.html" import icon_user, icon_email, icon_users, icon_tag %}
{% block title %}{{ network_name }} - Admin{% endblock %}
{% block title %}Admin - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-4">

View File

@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% from "macros/icons.html" import icon_success, icon_error, icon_alert %}
{% block title %}{{ network_name }} - Members Admin{% endblock %}
{% block title %}Admin: Members - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-6">

View File

@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% from "macros/icons.html" import icon_success, icon_error, icon_alert, icon_info, icon_tag %}
{% block title %}{{ network_name }} - Node Tags Admin{% endblock %}
{% block title %}Admin: Node Tags - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-6">

View File

@@ -2,7 +2,7 @@
{% from "_macros.html" import pagination %}
{% from "macros/icons.html" import icon_alert %}
{% block title %}{{ network_name }} - Advertisements{% endblock %}
{% block title %}Advertisements - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-6">

View File

@@ -54,7 +54,7 @@
<li><a href="/" class="{% if request.url.path == '/' %}active{% endif %}">{{ icon_home("h-4 w-4") }} Home</a></li>
<li><a href="/dashboard" class="{% if request.url.path == '/dashboard' %}active{% endif %}">{{ icon_dashboard("h-4 w-4") }} Dashboard</a></li>
<li><a href="/nodes" class="{% if '/nodes' in request.url.path %}active{% endif %}">{{ icon_nodes("h-4 w-4") }} Nodes</a></li>
<li><a href="/advertisements" class="{% if request.url.path == '/advertisements' %}active{% endif %}">{{ icon_advertisements("h-4 w-4") }} Adverts</a></li>
<li><a href="/advertisements" class="{% if request.url.path == '/advertisements' %}active{% endif %}">{{ icon_advertisements("h-4 w-4") }} Advertisements</a></li>
<li><a href="/messages" class="{% if request.url.path == '/messages' %}active{% endif %}">{{ icon_messages("h-4 w-4") }} Messages</a></li>
<li><a href="/map" class="{% if request.url.path == '/map' %}active{% endif %}">{{ icon_map("h-4 w-4") }} Map</a></li>
<li><a href="/members" class="{% if request.url.path == '/members' %}active{% endif %}">{{ icon_members("h-4 w-4") }} Members</a></li>
@@ -73,7 +73,7 @@
<li><a href="/" class="{% if request.url.path == '/' %}active{% endif %}">{{ icon_home("h-4 w-4") }} Home</a></li>
<li><a href="/dashboard" class="{% if request.url.path == '/dashboard' %}active{% endif %}">{{ icon_dashboard("h-4 w-4") }} Dashboard</a></li>
<li><a href="/nodes" class="{% if '/nodes' in request.url.path %}active{% endif %}">{{ icon_nodes("h-4 w-4") }} Nodes</a></li>
<li><a href="/advertisements" class="{% if request.url.path == '/advertisements' %}active{% endif %}">{{ icon_advertisements("h-4 w-4") }} Adverts</a></li>
<li><a href="/advertisements" class="{% if request.url.path == '/advertisements' %}active{% endif %}">{{ icon_advertisements("h-4 w-4") }} Advertisements</a></li>
<li><a href="/messages" class="{% if request.url.path == '/messages' %}active{% endif %}">{{ icon_messages("h-4 w-4") }} Messages</a></li>
<li><a href="/map" class="{% if request.url.path == '/map' %}active{% endif %}">{{ icon_map("h-4 w-4") }} Map</a></li>
<li><a href="/members" class="{% if request.url.path == '/members' %}active{% endif %}">{{ icon_members("h-4 w-4") }} Members</a></li>

View File

@@ -1,15 +1,11 @@
{% extends "base.html" %}
{% from "macros/icons.html" import icon_nodes, icon_advertisements, icon_messages, icon_alert, icon_refresh, icon_channel %}
{% from "macros/icons.html" import icon_nodes, icon_advertisements, icon_messages, icon_alert, icon_channel %}
{% block title %}{{ network_name }} - Network Overview{% endblock %}
{% block title %}Dashboard - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-6">
<h1 class="text-3xl font-bold">Network Overview</h1>
<button onclick="location.reload()" class="btn btn-ghost btn-sm">
{{ icon_refresh("h-5 w-5") }}
Refresh
</button>
<h1 class="text-3xl font-bold">Dashboard</h1>
</div>
{% if api_error %}

View File

@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% from "macros/icons.html" import icon_dashboard, icon_map, icon_nodes, icon_advertisements, icon_messages, icon_page, icon_info, icon_chart, icon_globe, icon_github %}
{% block title %}{{ network_name }} - Home{% endblock %}
{% block title %}{{ network_name }}{% endblock %}
{% block content %}
<!-- Hero Section with Stats -->

View File

@@ -1,11 +1,10 @@
{% extends "base.html" %}
{% block title %}{{ network_name }} - Node Map{% endblock %}
{% block title %}Map - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-6">
<h1 class="text-3xl font-bold">Node Map</h1>
<h1 class="text-3xl font-bold">Map</h1>
<div class="flex items-center gap-2">
<span id="node-count" class="badge badge-lg">Loading...</span>
<span id="filtered-count" class="badge badge-lg badge-ghost hidden"></span>

View File

@@ -1,11 +1,11 @@
{% extends "base.html" %}
{% from "macros/icons.html" import icon_info %}
{% block title %}{{ network_name }} - Members{% endblock %}
{% block title %}Members - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-6">
<h1 class="text-3xl font-bold">Network Members</h1>
<h1 class="text-3xl font-bold">Members</h1>
<span class="badge badge-lg">{{ members|length }} members</span>
</div>

View File

@@ -2,7 +2,7 @@
{% from "_macros.html" import pagination %}
{% from "macros/icons.html" import icon_alert %}
{% block title %}{{ network_name }} - Messages{% endblock %}
{% block title %}Messages - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-6">

View File

@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% from "macros/icons.html" import icon_alert, icon_error %}
{% block title %}{{ network_name }} - Node Details{% endblock %}
{% block title %}{% if node %}{{ node.name or ('Node ' ~ public_key[:8] ~ '...') }} - {{ network_name }}{% else %}Node Not Found - {{ network_name }}{% endif %}{% endblock %}
{% block extra_head %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>

View File

@@ -2,7 +2,7 @@
{% from "_macros.html" import pagination %}
{% from "macros/icons.html" import icon_alert %}
{% block title %}{{ network_name }} - Nodes{% endblock %}
{% block title %}Nodes - {{ network_name }}{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-6">