luci-theme: fix theme header title
authorPaul Donald <redacted>
Wed, 21 Jan 2026 21:39:04 +0000 (22:39 +0100)
committerPaul Donald <redacted>
Wed, 21 Jan 2026 21:39:04 +0000 (22:39 +0100)
dispatched.title is sometimes null, especially where menu JSON
does not declare a title for a page.

Also, while we're here, wrap these in i18n tags, since the
JSON titles are often translated (they're included in po matter).

Closes #8222

Signed-off-by: Paul Donald <redacted>
themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/header.ut
themes/luci-theme-material/ucode/template/themes/material/header.ut
themes/luci-theme-openwrt-2020/ucode/template/themes/openwrt2020/header.ut
themes/luci-theme-openwrt/ucode/template/themes/openwrt.org/header.ut

index 85216214e9b233ae918c5555c921e1f6b63b7449..6a4af93f840f7d6265837ce89671dc9025ab9293 100644 (file)
@@ -18,7 +18,7 @@
 <html lang="{{ dispatcher.lang }}" {{ darkpref ? `data-darkmode="${darkpref}"` : '' }}>
        <head>
                <meta charset="utf-8">
-               <title>{{ striptags(`${dispatched ? `${dispatched.title} | ` : ''}${boardinfo.hostname ?? '?'}`) }} | LuCI</title>
+               <title>{{ striptags(`${dispatched?.title ? `${_(dispatched.title)} | ` : ''}${boardinfo.hostname ?? '?'}`) }} | LuCI</title>
                {% if (!darkpref): %}
                        <script>
                                var mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'),
index e46ec9f287ccab59eecaa2a88ecc63090c2752ec..442928987cda810c335ccba21f620192dcde132e 100644 (file)
@@ -46,7 +46,7 @@
 {% endif %}
 <script src="{{ dispatcher.build_url('admin/translations', dispatcher.lang) }}"></script>
 <script src="{{ resource }}/cbi.js"></script>
-<title>{{ striptags(`${dispatched ? `${dispatched.title} | ` : ''}${boardinfo.hostname ?? '?'}`) }} | LuCI</title>
+<title>{{ striptags(`${dispatched?.title ? `${_(dispatched.title)} | ` : ''}${boardinfo.hostname ?? '?'}`) }} | LuCI</title>
 {% if (css): %}
 <style title="text/css">{{ css }}</style>
 {% endif %}
index 25a1719eea8fdfe8ddcf3d1ccd589f639029ad5c..1449f0fb8369b13b2ffdebaaa20a922d75152954 100644 (file)
@@ -22,7 +22,7 @@
 <link rel="icon" href="{{ media }}/logo.svg" sizes="any">
 <script src="{{ dispatcher.build_url('admin/translations', dispatcher.lang) }}"></script>
 <script src="{{ resource }}/cbi.js"></script>
-<title>{{ striptags(`${dispatched ? `${dispatched.title} | ` : ''}${boardinfo.hostname ?? '?'}`) }} | LuCI</title>
+<title>{{ striptags(`${dispatched?.title ? `${_(dispatched.title)} | ` : ''}${boardinfo.hostname ?? '?'}`) }} | LuCI</title>
 {% if (css): %}
 <style title="text/css">{{ css }}</style>
 {% endif %}
index a1773aa62ec122ed3aa8a269383b5f42a33791c0..ce3596b3fc49d90d7c2bc52f6b11517ef0051f89 100644 (file)
@@ -28,7 +28,7 @@
 <script src="{{ dispatcher.build_url('admin/translations', dispatcher.lang) }}"></script>
 <script src="{{ resource }}/cbi.js"></script>
 
-<title>{{ striptags(`${dispatched ? `${dispatched.title} | ` : ''}${boardinfo.hostname ?? '?'}`) }} | LuCI</title>
+<title>{{ striptags(`${dispatched?.title ? `${_(dispatched.title)} | ` : ''}${boardinfo.hostname ?? '?'}`) }} | LuCI</title>
 </head>
 <body class="lang_{{ dispatcher.lang }}" data-page="{{ entityencode(join('-', ctx.request_path), true) }}">
 
git clone https://git.99rst.org/PROJECT