From 9cc8614001cf0d2ed17880f4f6d16a0a6e9dfee0 Mon Sep 17 00:00:00 2001 From: Carlin MacKenzie Date: Tue, 19 Mar 2024 16:08:53 +0100 Subject: [PATCH 1/3] UX: Add THEME_SITENAME as a suffix in --- invenio_theme/templates/semantic-ui/invenio_theme/page.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/invenio_theme/templates/semantic-ui/invenio_theme/page.html b/invenio_theme/templates/semantic-ui/invenio_theme/page.html index 5f5f3707..9bbb65d1 100644 --- a/invenio_theme/templates/semantic-ui/invenio_theme/page.html +++ b/invenio_theme/templates/semantic-ui/invenio_theme/page.html @@ -26,8 +26,7 @@ {%- endblock head_meta %} {%- block head_title %} - {%- set title = title or _(config.THEME_SITENAME) or _('Invenio') %} - {{title}} + {%- if title %}{{title}} | {% endif -%}{{ _(config.THEME_SITENAME) or _('Invenio') }} {%- endblock head_title %} {%- block head_links %} From e29f697cc731d17ceffb2a020f2662b63ac036e0 Mon Sep 17 00:00:00 2001 From: Carlin MacKenzie Date: Fri, 5 Apr 2024 11:38:19 +0200 Subject: [PATCH 2/3] bug: prevent title | title --- .../templates/semantic-ui/invenio_theme/page.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/invenio_theme/templates/semantic-ui/invenio_theme/page.html b/invenio_theme/templates/semantic-ui/invenio_theme/page.html index 9bbb65d1..a0f9a339 100644 --- a/invenio_theme/templates/semantic-ui/invenio_theme/page.html +++ b/invenio_theme/templates/semantic-ui/invenio_theme/page.html @@ -26,7 +26,14 @@ {%- endblock head_meta %} {%- block head_title %} - {%- if title %}{{title}} | {% endif -%}{{ _(config.THEME_SITENAME) or _('Invenio') }} + {% set show_title = true %} + {% set sitename = _(config.THEME_SITENAME) or _('Invenio') %} + {% if title %} + {% if title == sitename %} + {% set show_title = false %} + {% endif -%} + {% endif -%} + {%- if show_title and title %}{{title}} | {% endif -%}{{ sitename }} {%- endblock head_title %} {%- block head_links %} From 7931d03287e15b928ee4ffcd28ef07b0acb0551c Mon Sep 17 00:00:00 2001 From: Carlin MacKenzie Date: Fri, 5 Apr 2024 11:58:49 +0200 Subject: [PATCH 3/3] refactor: shorten logic --- .../templates/semantic-ui/invenio_theme/page.html | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/invenio_theme/templates/semantic-ui/invenio_theme/page.html b/invenio_theme/templates/semantic-ui/invenio_theme/page.html index a0f9a339..90e6716d 100644 --- a/invenio_theme/templates/semantic-ui/invenio_theme/page.html +++ b/invenio_theme/templates/semantic-ui/invenio_theme/page.html @@ -26,14 +26,9 @@ {%- endblock head_meta %} {%- block head_title %} - {% set show_title = true %} {% set sitename = _(config.THEME_SITENAME) or _('Invenio') %} - {% if title %} - {% if title == sitename %} - {% set show_title = false %} - {% endif -%} - {% endif -%} - {%- if show_title and title %}{{title}} | {% endif -%}{{ sitename }} + {% set show_title = title and title != sitename %} + {%- if show_title %}{{title}} | {% endif -%}{{ sitename }} {%- endblock head_title %} {%- block head_links %}