Skip to content

Commit 60f2f0d

Browse files
AndySDHQuy
andauthored
[4.0] Shouldn't Article Title be H1? (#32448)
* Article Title should be H1 I get that H1 can also be the "Page Heading" aka Menu Title. But in an article view, you're most likely not gonna wanna have the Menu Title as an H1. Or even if so, it's better to run the risk of having two H1 (if a menu name is displayed), than the article title not being an H1. I personally don't care as I fix it in template overrides anyway. But as a standard, common practice, my two cents is that Article title should be H1 by default. * Make Title H1 only if Menu Title is not displayed * Cleaner code * Update components/com_content/tmpl/article/default.php Co-authored-by: Quy <[email protected]> * Update components/com_content/tmpl/article/default.php Co-authored-by: Quy <[email protected]> * separate assignment and echo as per feedback, to make it more obvious where the value is coming from Co-authored-by: Quy <[email protected]>
1 parent c4ddfb8 commit 60f2f0d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/com_content/tmpl/article/default.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
$canEdit = $params->get('access-edit');
2727
$user = Factory::getUser();
2828
$info = $params->get('info_block_position', 0);
29+
$htag = $this->params->get('show_page_heading') ? 'h2' : 'h1';
2930

3031
// Check if associations are implemented. If they are, define the parameter.
3132
$assocParam = (Associations::isEnabled() && $params->get('show_associations'));
@@ -52,9 +53,9 @@
5253

5354
<?php if ($params->get('show_title')) : ?>
5455
<div class="page-header">
55-
<h2 itemprop="headline">
56+
<<?php echo $htag; ?> itemprop="headline">
5657
<?php echo $this->escape($this->item->title); ?>
57-
</h2>
58+
</<?php echo $htag; ?>>
5859
<?php if ($this->item->state == ContentComponent::CONDITION_UNPUBLISHED) : ?>
5960
<span class="badge bg-warning text-dark"><?php echo Text::_('JUNPUBLISHED'); ?></span>
6061
<?php endif; ?>

0 commit comments

Comments
 (0)