Changing article titles from h2 heading to h1 heading

Discuss Search Engine Optimization in relation to Joomla!. This forum will also have discussions on SEF/SEO Joomla! extensions.

Moderator: General Support Moderators

Locked
egrohs
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Sun Jan 30, 2011 4:52 am

Changing article titles from h2 heading to h1 heading

Post by egrohs » Fri Dec 23, 2011 3:24 pm

I am using frontpage blog layout for my site www.njteachertalk.com

It seems by default, the article titles are surrounded by h2 headings. So when I assess my site with different tools, its telling me that I do not have any h1 headings. I have tried to override the css html com_content file but it is not reflecting my changes. Still h2 headings. I have used this extension,

http://extensions.joomla.org/extensions ... JywiO30%3D

This extension actually does surround the article titles with h1 headings but it also keeps the h2 headings. So the article title drops down and the h2 empty heading remains.

How can I rectify this to take out the h2 headings and make the article titles h1 headings? Any help would be greatly appreciated.

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12781
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: Changing article titles from h2 heading to h1 heading

Post by brian » Fri Dec 23, 2011 3:25 pm

You need to override the template view

http://docs.joomla.org/How_to_override_ ... omla!_core
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

egrohs
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Sun Jan 30, 2011 4:52 am

Re: Changing article titles from h2 heading to h1 heading

Post by egrohs » Fri Dec 23, 2011 4:19 pm

Yeah, I read this in my 2 days of trying to work this problem out. I am new to all this and still am not getting it. Anyway to shed some clarity in laymens terms what I need to do.

Thanks

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30815
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Changing article titles from h2 heading to h1 heading

Post by Per Yngve Berg » Fri Dec 23, 2011 5:50 pm

H1 tags are used for the Page Title.
H2 tags is used for the Article Title.

I presume you have turned Page Title off.
Changing the Article Titles to H1 is probably not worth the effort.

egrohs
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Sun Jan 30, 2011 4:52 am

Re: Changing article titles from h2 heading to h1 heading

Post by egrohs » Fri Dec 23, 2011 6:19 pm

When I turn page title on where my home menu is located , I still get the page title enclosed in h2 headings. No h1 headings turn up. I am using frontpage blog layout.

How do I get the h1 headings for page title then?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30815
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Changing article titles from h2 heading to h1 heading

Post by Per Yngve Berg » Fri Dec 23, 2011 6:47 pm

In fact J1.5 do show the Page Title in a div. No h tags at all. J1.7 uses h1 tags.

Is there a frontpage folder under your template's html folder?

Here is the core's code for the Page Title

Code: Select all

<?php if ($this->params->get('show_page_title', 1)) : ?>
<div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
	<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>

egrohs
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Sun Jan 30, 2011 4:52 am

Re: Changing article titles from h2 heading to h1 heading

Post by egrohs » Sat Dec 24, 2011 3:21 am

Yes, there is a frontpage folder under the template html folder. So I took that code and pasted it in the html frontpage folder. The title pops up with the h1 headings above the actual box with the title. Am I suppose to now just style it the way I want through the template css folder?

See what I mean: (the white text, Welcome NJ Teachers)

http://www.njteachertalk.com/

So if 1.5 doesn't use h1 tags, is it that important to have them? Is it fine in terms of SEO to just have the h2 tags surrounding the article titles? and the h2 tags surrounding the page title?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30815
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Changing article titles from h2 heading to h1 heading

Post by Per Yngve Berg » Sat Dec 24, 2011 8:39 am

Why not put a H1 tag here:

Code: Select all

<span class="breadcrumbs pathway">
Welcome to NJTeacherTalk.         A place where NJ educators can let their voices be heard. Simply register to submit your own articles and editorials for posting. Participate. Discuss. Research. Network. Socialize.</span>

egrohs
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Sun Jan 30, 2011 4:52 am

Re: Changing article titles from h2 heading to h1 heading

Post by egrohs » Sat Dec 24, 2011 7:50 pm

That would be great? How do I do that?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30815
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Changing article titles from h2 heading to h1 heading

Post by Per Yngve Berg » Sun Dec 25, 2011 8:49 am

How did the text got there?

It looks like a module.

egrohs
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Sun Jan 30, 2011 4:52 am

Re: Changing article titles from h2 heading to h1 heading

Post by egrohs » Sun Dec 25, 2011 3:32 pm

Yeah, the breadcrumbs module. Still not sure how I surround that with h1 tags?

egrohs
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Sun Jan 30, 2011 4:52 am

Re: Changing article titles from h2 heading to h1 heading

Post by egrohs » Wed Dec 28, 2011 4:03 am

Per, ya still there? Any guidance with how to surround breadcrumbs text with h1 tags?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30815
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Changing article titles from h2 heading to h1 heading

Post by Per Yngve Berg » Wed Dec 28, 2011 7:18 am

It's not the Breadcrump module. It would have display "You are here: Home"

Is there some other module published in the Breadcrump-path position?

LaurentNeuville
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Jan 31, 2013 12:11 pm
Location: Montpellier, France
Contact:

Re: Changing article titles from h2 heading to h1 heading

Post by LaurentNeuville » Thu Jan 31, 2013 12:16 pm

Hi guys.

I know the topic isn't fresh, but it came out while I was looking to solve the same issue on a Joomla 2.5.7 ... I found a good and clean method here :
http://www.itoctopus.com/how-to-change- ... -in-joomla
I thought it'd be nice to share it. i tried option N°3 and it worked just fine.

mohsen210007
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Feb 07, 2013 10:46 am

Re: Changing article titles from h2 heading to h1 heading

Post by mohsen210007 » Thu Feb 07, 2013 5:59 pm

Per Yngve Berg wrote:H1 tags are used for the Page Title.
H2 tags is used for the Article Title.

I presume you have turned Page Title off.
Changing the Article Titles to H1 is probably not worth the effort.
yeah i think its not a good idea to change h2 tittle of article to h1.

it has no effort in the new method of google.

Ironside
Joomla! Ace
Joomla! Ace
Posts: 1733
Joined: Mon Nov 13, 2006 8:01 pm
Contact:

Re: Changing article titles from h2 heading to h1 heading

Post by Ironside » Mon May 06, 2013 12:45 pm

I was also looking for a way to change my H2 tags to H1 and I came across this fantastic plug-in. No need to hack into the core or change anything within the template. It's really good. So if you ever change your template and you find that the page headings revert back to h1 tags, you can simply remove the plug-in.

http://www.conflate.nl/joomla-extensions.html
Ham and eggs. A day's work for a chicken, a lifetime commitment for a pig.

http://www.tetraplegicliving.com
http://www.oscarfishlover.com

Leolaus
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu May 10, 2012 7:34 am

Re: Changing article titles from h2 heading to h1 heading

Post by Leolaus » Fri May 17, 2013 9:18 am

Perfect for everyone I guess, thanks!
LaurentNeuville wrote:Hi guys.

I know the topic isn't fresh, but it came out while I was looking to solve the same issue on a Joomla 2.5.7 ... I found a good and clean method here :
http://www.itoctopus.com/how-to-change- ... -in-joomla
I thought it'd be nice to share it. i tried option N°3 and it worked just fine.

kamome
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Sun May 29, 2011 1:35 pm

Re: Changing article titles from h2 heading to h1 heading

Post by kamome » Tue Aug 13, 2013 4:45 pm

The way I do this in my template's html/com_content/article/default.php:

Code: Select all

<? // changed div to article ?>
<article class="item-page<?php echo $this->pageclass_sfx; ?>" >
<?php if ($this->params->get('show_page_heading', 1)): ?>
  <h1 role="heading" aria-level="1"><?php echo $this->escape($this->params->get('page_heading'))    ; ?></h1>
<?php endif; ?>
<?php if (!empty($this->item->pagination) && $this->item->pagination && !$this->item->paginationposition && $this->i    tem->paginationrelative) {
  echo $this->item->pagination;
} ?>
<?php // changed from static h2 ?>
<?php if ($params->get('show_title')): ?>
  <?php if ($this->params->get('show_page_heading', 1)): ?>
    <h2 role="heading" aria-level="2">
  <?php else: ?>
    <h1 role="heading" aria-level="1">
  <?php endif; ?>
  <?php if ($params->get('link_titles') && !empty($this->item->readmore_link)): ?>
    <a href="<?php echo $this->item->readmore_link; ?>"><?php echo $this->escape($this->item->title); ?></a>
  <?php else : ?>
    <?php echo $this->escape($this->item->title); ?>
  <?php endif; ?>
  <?php if ($this->params->get('show_page_heading', 1)): ?>
    </h2>
  <?php else: ?>
    </h1>
  <?php endif; ?>
<?php endif; ?>
So, an override, just like Brian pointed out.
Edit: Removed "textshadow" class from h1 - that was just from a specific template.

Elliott Parker
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Wed Sep 16, 2015 2:42 am
Location: Chicago
Contact:

Re: Changing article titles from h2 heading to h1 heading

Post by Elliott Parker » Wed Sep 16, 2015 2:47 am

<bump>

Has anyone found out a plug-in or another way to accomplish editing the title of a blog post?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30815
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Changing article titles from h2 heading to h1 heading

Post by Per Yngve Berg » Wed Sep 16, 2015 7:29 am

Edit the Page Title on the menu item.

User avatar
bhaumik
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri May 18, 2012 6:24 am

Re: Changing article titles from h2 heading to h1 heading

Post by bhaumik » Thu Dec 03, 2015 8:19 pm

brian wrote:You need to override the template view

http://docs.joomla.org/How_to_override_ ... omla!_core
Instead of spending time on searching for configuration, I used this trick.
Thanks,

farhan258
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Tue May 30, 2017 6:30 am

Re: Changing article titles from h2 heading to h1 heading

Post by farhan258 » Fri Jun 23, 2017 4:48 am

All you need to do is create a Joomla System plugin that only works on the frontend and that has the following code at heart:


function onAfterRender()
{
$app = &JFactory::getApplication();
if($app->isAdmin() || JDEBUG) {
return;
}
$body = JResponse::getBody();
str_replace('h2>', 'h1>', $body);
JResponse::setBody($body);
}

The problem with the above method, however, is that you won’t be able to use h2 tags anymore anywhere – which makes it less than ideal. Another problem is that you will be using a plugin, thus creating extra overhead on the rendering of the page.


Locked

Return to “Search Engine Optimization (Joomla! SEO) in Joomla! 1.5”