From c540e15432524327ec59c22ae647fa9fe53796f4 Mon Sep 17 00:00:00 2001 From: Louis King Date: Sun, 8 Feb 2026 21:40:19 +0000 Subject: [PATCH] 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 --- src/meshcore_hub/web/app.py | 4 +++- .../web/templates/admin/access_denied.html | 2 +- src/meshcore_hub/web/templates/admin/index.html | 2 +- src/meshcore_hub/web/templates/admin/members.html | 2 +- src/meshcore_hub/web/templates/admin/node_tags.html | 2 +- src/meshcore_hub/web/templates/advertisements.html | 2 +- src/meshcore_hub/web/templates/base.html | 4 ++-- src/meshcore_hub/web/templates/dashboard.html | 10 +++------- src/meshcore_hub/web/templates/home.html | 2 +- src/meshcore_hub/web/templates/map.html | 5 ++--- src/meshcore_hub/web/templates/members.html | 4 ++-- src/meshcore_hub/web/templates/messages.html | 2 +- src/meshcore_hub/web/templates/node_detail.html | 2 +- src/meshcore_hub/web/templates/nodes.html | 2 +- 14 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/meshcore_hub/web/app.py b/src/meshcore_hub/web/app.py index 258c544..581019b 100644 --- a/src/meshcore_hub/web/app.py +++ b/src/meshcore_hub/web/app.py @@ -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 diff --git a/src/meshcore_hub/web/templates/admin/access_denied.html b/src/meshcore_hub/web/templates/admin/access_denied.html index 1547f4c..1e0b91e 100644 --- a/src/meshcore_hub/web/templates/admin/access_denied.html +++ b/src/meshcore_hub/web/templates/admin/access_denied.html @@ -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 %}
diff --git a/src/meshcore_hub/web/templates/admin/index.html b/src/meshcore_hub/web/templates/admin/index.html index ba13560..ad821a8 100644 --- a/src/meshcore_hub/web/templates/admin/index.html +++ b/src/meshcore_hub/web/templates/admin/index.html @@ -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 %}
diff --git a/src/meshcore_hub/web/templates/admin/members.html b/src/meshcore_hub/web/templates/admin/members.html index 75f4aec..1364f8b 100644 --- a/src/meshcore_hub/web/templates/admin/members.html +++ b/src/meshcore_hub/web/templates/admin/members.html @@ -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 %}
diff --git a/src/meshcore_hub/web/templates/admin/node_tags.html b/src/meshcore_hub/web/templates/admin/node_tags.html index fe60822..5d8b7da 100644 --- a/src/meshcore_hub/web/templates/admin/node_tags.html +++ b/src/meshcore_hub/web/templates/admin/node_tags.html @@ -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 %}
diff --git a/src/meshcore_hub/web/templates/advertisements.html b/src/meshcore_hub/web/templates/advertisements.html index da63c55..51e0571 100644 --- a/src/meshcore_hub/web/templates/advertisements.html +++ b/src/meshcore_hub/web/templates/advertisements.html @@ -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 %}
diff --git a/src/meshcore_hub/web/templates/base.html b/src/meshcore_hub/web/templates/base.html index 6c692e3..bb02724 100644 --- a/src/meshcore_hub/web/templates/base.html +++ b/src/meshcore_hub/web/templates/base.html @@ -54,7 +54,7 @@
  • {{ icon_home("h-4 w-4") }} Home
  • {{ icon_dashboard("h-4 w-4") }} Dashboard
  • {{ icon_nodes("h-4 w-4") }} Nodes
  • -
  • {{ icon_advertisements("h-4 w-4") }} Adverts
  • +
  • {{ icon_advertisements("h-4 w-4") }} Advertisements
  • {{ icon_messages("h-4 w-4") }} Messages
  • {{ icon_map("h-4 w-4") }} Map
  • {{ icon_members("h-4 w-4") }} Members
  • @@ -73,7 +73,7 @@
  • {{ icon_home("h-4 w-4") }} Home
  • {{ icon_dashboard("h-4 w-4") }} Dashboard
  • {{ icon_nodes("h-4 w-4") }} Nodes
  • -
  • {{ icon_advertisements("h-4 w-4") }} Adverts
  • +
  • {{ icon_advertisements("h-4 w-4") }} Advertisements
  • {{ icon_messages("h-4 w-4") }} Messages
  • {{ icon_map("h-4 w-4") }} Map
  • {{ icon_members("h-4 w-4") }} Members
  • diff --git a/src/meshcore_hub/web/templates/dashboard.html b/src/meshcore_hub/web/templates/dashboard.html index 9a70c41..37d7e8e 100644 --- a/src/meshcore_hub/web/templates/dashboard.html +++ b/src/meshcore_hub/web/templates/dashboard.html @@ -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 %}
    -

    Network Overview

    - +

    Dashboard

    {% if api_error %} diff --git a/src/meshcore_hub/web/templates/home.html b/src/meshcore_hub/web/templates/home.html index c943974..82f5194 100644 --- a/src/meshcore_hub/web/templates/home.html +++ b/src/meshcore_hub/web/templates/home.html @@ -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 %} diff --git a/src/meshcore_hub/web/templates/map.html b/src/meshcore_hub/web/templates/map.html index f6f019a..b6efa03 100644 --- a/src/meshcore_hub/web/templates/map.html +++ b/src/meshcore_hub/web/templates/map.html @@ -1,11 +1,10 @@ {% extends "base.html" %} -{% block title %}{{ network_name }} - Node Map{% endblock %} - +{% block title %}Map - {{ network_name }}{% endblock %} {% block content %}
    -

    Node Map

    +

    Map

    Loading... diff --git a/src/meshcore_hub/web/templates/members.html b/src/meshcore_hub/web/templates/members.html index 3d3ca25..b503a3f 100644 --- a/src/meshcore_hub/web/templates/members.html +++ b/src/meshcore_hub/web/templates/members.html @@ -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 %}
    -

    Network Members

    +

    Members

    {{ members|length }} members
    diff --git a/src/meshcore_hub/web/templates/messages.html b/src/meshcore_hub/web/templates/messages.html index c376b04..0a12756 100644 --- a/src/meshcore_hub/web/templates/messages.html +++ b/src/meshcore_hub/web/templates/messages.html @@ -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 %}
    diff --git a/src/meshcore_hub/web/templates/node_detail.html b/src/meshcore_hub/web/templates/node_detail.html index fecc0b9..a1673e9 100644 --- a/src/meshcore_hub/web/templates/node_detail.html +++ b/src/meshcore_hub/web/templates/node_detail.html @@ -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 %} diff --git a/src/meshcore_hub/web/templates/nodes.html b/src/meshcore_hub/web/templates/nodes.html index 040f7ec..0482b19 100644 --- a/src/meshcore_hub/web/templates/nodes.html +++ b/src/meshcore_hub/web/templates/nodes.html @@ -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 %}