Skip to content

Fix: Refine page title and H1 heading logic #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2025

Conversation

IngmarStein
Copy link
Member

  • Modified base.html to conditionally add a separator to the page title. If a page defines a specific title, it will be shown as "Page Title - Tronbyt Manager". If a page has no specific title, the browser title will be just "Tronbyt Manager".

  • Adjusted manager/index.html and manager/adminindex.html to explicitly set their main <h1> heading to "Tronbyt Manager". This ensures they have a visible heading while their browser tab title correctly defaults to "Tronbyt Manager".

This addresses the issue where some pages had concatenated titles (e.g., "LoginTronbyt Manager") and ensures that main index pages have appropriate titles and headings.

Fixes #275

- Modified `base.html` to conditionally add a separator to the page
  title. If a page defines a specific title, it will be shown as
  "Page Title - Tronbyt Manager". If a page has no specific title,
  the browser title will be just "Tronbyt Manager".

- Adjusted `manager/index.html` and `manager/adminindex.html` to
  explicitly set their main `<h1>` heading to "Tronbyt Manager".
  This ensures they have a visible heading while their browser tab
  title correctly defaults to "Tronbyt Manager".

This addresses the issue where some pages had concatenated titles
(e.g., "LoginTronbyt Manager") and ensures that main index pages
have appropriate titles and headings.
@IngmarStein IngmarStein requested a review from Copilot June 24, 2025 12:51
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @IngmarStein, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on improving the consistency and clarity of page titles and main headings across the application. It standardizes how browser tab titles are displayed by introducing conditional formatting and ensures that core index pages have explicit, visible <h1> headings, addressing previous UI inconsistencies.

Highlights

  • Refined Page Title Logic: I've updated the base HTML template (base.html) to conditionally add a separator (-) before 'Tronbyt Manager' in the browser tab title. This ensures that if a specific page title is provided (e.g., 'Login'), it will display as 'Login - Tronbyt Manager', but if no specific title is set, it will simply show 'Tronbyt Manager', preventing concatenated titles like 'LoginTronbyt Manager'.
  • Consistent H1 Headings: I've explicitly set the main <h1> headings for the manager index page (manager/index.html) and the admin index page (manager/adminindex.html) to 'Tronbyt Manager'. This guarantees that these key pages always have a clear and consistent on-page heading, aligning with their default browser tab title.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refines the browser title formatting in base.html to include a separator only when a page-specific title is present, and ensures the main index pages explicitly render an <h1> heading of "Tronbyt Manager".

  • Add conditional hyphen before "Tronbyt Manager" in <title> tag when a block title exists.
  • Replace empty title blocks with a static, translated <h1> in index.html and adminindex.html.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tronbyt_server/templates/base.html Use {% if self.title() %} to conditionally insert " - "
tronbyt_server/templates/manager/index.html Replace <h1>{% block title %}</h1> with <h1>{{ _('Tronbyt Manager') }}</h1>
tronbyt_server/templates/manager/adminindex.html Same H1 replacement for admin index
Comments suppressed due to low confidence (1)

tronbyt_server/templates/base.html:6

  • Add or update a template test to verify that the hyphen separator appears only when a page title is provided, and is omitted otherwise.
<title>{% if self.title() %}{% block title %}{% endblock %} - {% endif %}Tronbyt Manager</title>

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refines the page title and H1 heading logic for better consistency and clarity. The changes in base.html correctly use a conditional to add a separator in the page title only when a specific page title is defined, which elegantly solves the issue of concatenated titles. The modifications in manager/index.html and manager/adminindex.html ensure that these main pages have a visible <h1> heading, improving user experience. The implementation is clean, follows best practices for Jinja2 templating, and effectively addresses the stated goals. The code quality is high, and I found no issues of medium or higher severity.

@IngmarStein IngmarStein merged commit 73a22b4 into tronbyt:main Jun 24, 2025
1 check passed
@IngmarStein IngmarStein deleted the fix/conditional-page-titles branch June 24, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix page titles
1 participant