Page 1 of 1

Changing article titles from h2 heading to h1 heading

Posted: Fri Dec 23, 2011 3:24 pm
by egrohs
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.

Re: Changing article titles from h2 heading to h1 heading

Posted: Fri Dec 23, 2011 3:25 pm
by brian
You need to override the template view

http://docs.joomla.org/How_to_override_ ... omla!_core

Re: Changing article titles from h2 heading to h1 heading

Posted: Fri Dec 23, 2011 4:19 pm
by egrohs
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

Re: Changing article titles from h2 heading to h1 heading

Posted: Fri Dec 23, 2011 5:50 pm
by Per Yngve Berg
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.

Re: Changing article titles from h2 heading to h1 heading

Posted: Fri Dec 23, 2011 6:19 pm
by egrohs
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?

Re: Changing article titles from h2 heading to h1 heading

Posted: Fri Dec 23, 2011 6:47 pm
by Per Yngve Berg
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; ?>

Re: Changing article titles from h2 heading to h1 heading

Posted: Sat Dec 24, 2011 3:21 am
by egrohs
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?

Re: Changing article titles from h2 heading to h1 heading

Posted: Sat Dec 24, 2011 8:39 am
by Per Yngve Berg
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>

Re: Changing article titles from h2 heading to h1 heading

Posted: Sat Dec 24, 2011 7:50 pm
by egrohs
That would be great? How do I do that?

Re: Changing article titles from h2 heading to h1 heading

Posted: Sun Dec 25, 2011 8:49 am
by Per Yngve Berg
How did the text got there?

It looks like a module.

Re: Changing article titles from h2 heading to h1 heading

Posted: Sun Dec 25, 2011 3:32 pm
by egrohs
Yeah, the breadcrumbs module. Still not sure how I surround that with h1 tags?

Re: Changing article titles from h2 heading to h1 heading

Posted: Wed Dec 28, 2011 4:03 am
by egrohs
Per, ya still there? Any guidance with how to surround breadcrumbs text with h1 tags?

Re: Changing article titles from h2 heading to h1 heading

Posted: Wed Dec 28, 2011 7:18 am
by Per Yngve Berg
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?

Re: Changing article titles from h2 heading to h1 heading

Posted: Thu Jan 31, 2013 12:16 pm
by LaurentNeuville
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.

Re: Changing article titles from h2 heading to h1 heading

Posted: Thu Feb 07, 2013 5:59 pm
by mohsen210007
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.

Re: Changing article titles from h2 heading to h1 heading

Posted: Mon May 06, 2013 12:45 pm
by Ironside
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

Re: Changing article titles from h2 heading to h1 heading

Posted: Fri May 17, 2013 9:18 am
by Leolaus
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.

Re: Changing article titles from h2 heading to h1 heading

Posted: Tue Aug 13, 2013 4:45 pm
by kamome
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.

Re: Changing article titles from h2 heading to h1 heading

Posted: Wed Sep 16, 2015 2:47 am
by Elliott Parker
<bump>

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

Re: Changing article titles from h2 heading to h1 heading

Posted: Wed Sep 16, 2015 7:29 am
by Per Yngve Berg
Edit the Page Title on the menu item.

Re: Changing article titles from h2 heading to h1 heading

Posted: Thu Dec 03, 2015 8:19 pm
by bhaumik
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,

Re: Changing article titles from h2 heading to h1 heading

Posted: Fri Jun 23, 2017 4:48 am
by farhan258
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.