You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, the Page Title feature in Helix Ultimate Framework inherits the title of the parent menu item. While this works for static pages or when separate menu items are created for each sub-page, it falls short in dynamic scenarios like blogs or articles.
For example:
A parent menu item titled "Blog" will display "Blog" as the Page Title for all articles and categories under it, even when navigating through individual articles.
This is problematic because users expect the Page Title to dynamically reflect the actual content (e.g., article or category name).
Additionally, the current behavior can cause semantic issues with HTML heading structure:
The Page Title is rendered with either <h1> or <h2> tags. However, if the parent menu title is static, it does not align with the actual page content, leading to accessibility and SEO issues.
Describe the solution you'd like
I propose the following enhancements:
Dynamic Page Titles:
Update the title.php feature to detect the current page type.
If the page is an article, fetch and display the article title as the Page Title.
If the page is a category, fetch and display the category title as the Page Title.
Improved Heading Structure:
Ensure the <h1> tag dynamically reflects the article or category title.
Adjust secondary heading tags (e.g., <h2> or <h3>) to maintain proper semantic HTML structure.
Additional context
Here is an example of how this could be implemented in title.php:
$input = $app->input;
$option = $input->getCmd('option');
$view = $input->getCmd('view');
$id = $input->getInt('id');
if ($option == 'com_content' && $view == 'article' && $id) {
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__content'))
->where($db->quoteName('id') . ' = ' . (int) $id);
$db->setQuery($query);
$article_title = $db->loadResult();
if ($article_title) {
$page_title = $article_title;
}
} elseif ($option == 'com_categories' && $view == 'category' && $id) {
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__categories'))
->where($db->quoteName('id') . ' = ' . (int) $id);
$db->setQuery($query);
$category_title = $db->loadResult();
if ($category_title) {
$page_title = $category_title;
}
}
These changes will improve:
User Experience: Page Titles dynamically adapt to the displayed content, making navigation more intuitive.
SEO: Dynamic <h1> tags improve search engine optimization by aligning with the content of each page.
Semantic HTML Compliance: Proper heading structures ensure accessibility and align with HTML best practices.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently, the Page Title feature in Helix Ultimate Framework inherits the title of the parent menu item. While this works for static pages or when separate menu items are created for each sub-page, it falls short in dynamic scenarios like blogs or articles.
For example:
Additionally, the current behavior can cause semantic issues with HTML heading structure:
<h1>
or<h2>
tags. However, if the parent menu title is static, it does not align with the actual page content, leading to accessibility and SEO issues.Describe the solution you'd like
I propose the following enhancements:
Dynamic Page Titles:
title.php
feature to detect the current page type.Improved Heading Structure:
<h1>
tag dynamically reflects the article or category title.<h2>
or<h3>
) to maintain proper semantic HTML structure.Additional context
Here is an example of how this could be implemented in
title.php
:The text was updated successfully, but these errors were encountered: