Make Joomla Article Titles H1 and H2 Tags for SEO
The article titles on your Joomla website are probably not optimized to their full potential. More specifically, they aren’t H1 tags on the article pages and H2 tags on the category, section, and home pages. They also don’t have title attributes in the href links on the category, section and home pages. These header tags and href title attributes help search engines like Google and Bing identify the topic of your page or link and are considered helpful on-site SEO must-haves.
Note: This article is in regards to Joomla 1.5. I’m sure 1.6 and 1.7 are at least slightly different.
To remedy this, you’ll need to make changes in a few files in your Joomla website directory. These will cover changing the article pages to H1 tags and the article titles on the Frontpage, Section and Category pages to H2 tags. You’ll also need to replicate the php that generates the article title into a title=”” tag in the href link on the Frontpage, Section and Category pages.
Don’t worry, it’s not too difficult! See below for the locations (in Joomla 1.5 at least) of these files and the code changes you’ll need to make. Post a comment if you have any questions. You’ll want to start in your website’s root joomla directory for all of these file paths.
For article pages:
Navigate to:
[root]componentscom_contentviewsarticletmpldefault.php
Change:
To something like: (if you don’t want it to be a link.)
For the frontpage:
Navigate to:
[root]componentscom_contentviewsfrontpagetmpldefault_item.php
Change:
To something like this:
For Sections:
Navigate to:
[root]componentscom_contentviewssectiontmplblog_item.php
Change:
To something like this:
For Categories:
Navigate to:
[root]componentscom_contentviewscategorytmplblog_item.php
Change:
To something like this:
All done with the code changes (unless you need to work on your CSS file). If you copied these files onto your local machine, MAKE SURE you copy them back into their CORRECT directories on your web server.
Now you can style the H1 and H2 tags within the contentheading css class (.contentheading h1 / .contentheading h2) however you like. In my case, I copied over the contentheading link attribute and made it the same.
These changes will help with SEO, as long as your article titles are keyword driven and well constructed. Always remember to include what you think users will be searching for in your title, worded in a readable fashion, for the best chances of it ranking for those terms.
Let me know if you have any questions.
Still have h2 tags on article view, it looks as changing the [root]componentscom_contentviewsarticletmpldefault.php file does not affect the output of titles.
Hmm. I’ll try to take a look if I have a second, but I used this exact technique when I wrote the article for the site I was working on. I know things have changed with the newer versions of Joomla, though, so that is the first place to look.
Make sure your template doesn’t have an override in place for com_content. Check out template/html/com_content and edit that file, rather than hack the core of com_content which will be overwritten with future updates.
Ruth
I am trying to change h3 to h2 in overide but nothing seems to work, you would have thought in this day and age an extension would have been built to do seo issues like this.
Hi Diane,
Unfortunately, it’s the theme designers that put together the themes and templates originally that are typically to blame. They don’t understand SEO usually, which leads to poor “out of the box” customization. Because the code can be put anywhere and every theme/template is different, it’s also tough to create plugins that can accurately fix the problem.