Joomla Tips: Adding H1 Tag To Joomla Article Title

  admin
  August 4, 2013 6:03pm

As most SEO experts believe, H1 tag on a website article title is given more weight by search engines, particularly Google. I believe it too. Most of my articles here at JoomlaHacks.com comes out on page one in Google on every keywords I targeted. But Joomla does not tag the article title with H1. Instead they enclose it with "<td class="contentheading"></td>. Here's a short tutorial hack on how you can enclose it with H1 tag.

There are several ways. One way is using the template override, but this involves serious coding. So I will teach you the fast way, or the hacker way. This is for Joomla 1.5.x.

Edit the file /www/components/com_content/views/article/tmpl/default.php. On line number 14, you will see the following code:

<?php if ($this->params->get('show_title')) : ?>
<td class="contentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="100%">
<?php if ($this->params->get('link_titles') && $this->article->readmore_link != '') : ?>
<a href="/<?php echo $this->article->readmore_link; ?>" class="contentpagetitle<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
<?php echo $this->escape($this->article->title); ?></a>
<?php else : ?>
<?php echo $this->escape($this->article->title); ?>
<?php endif; ?>
</td>
<?php endif; ?>

 Modify that part by adding H1 tag.

<?php if ($this->params->get('show_title')) : ?>
<td class="contentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="100%">
<h1><?php if ($this->params->get('link_titles') && $this->article->readmore_link != '') : ?>
<a href="/<?php echo $this->article->readmore_link; ?>" class="contentpagetitle<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
<?php echo $this->escape($this->article->title); ?></a>
<?php else : ?>
<?php echo $this->escape($this->article->title); ?>
<?php endif; ?></h1>
</td>
<?php endif; ?>

If you don't like the format of H1, just define its CSS formatting in your template css file.

Remember, when you upgrade Joomla and default.php file was changed, this will overwrite your changes. If that happens, just edit the same file again.

Just a note, adding H1 is not the only technique in SEO. There are more to it. Maybe I will tackle this topic next time to share my expertise.

 

0 Reponse

Post Response
0

Hi,

I know a fast way too, to fix that problem. I work for the Aimy Extensions Team and we have developed a plugin that automatically turns the first H2 of a page into an H1 if there is no H1 heading. This solution has a big advantage: If there is a Joomla! upate you don't have to be afraid that your changed will be gone and you have to redo your work.

I hope this helps you. The extension is called Aimy H1 Heading: http://aimy-extensions.com/joomla/h1-heading.html

  Victoria_Aimy June 25, 2015 3:29am reply (0)