Changing H1 tags usage to make html output semantically correct #76

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
6 participants
@ashfame
Contributor

ashfame commented Sep 9, 2012

Right now H1 tag is being abused and there are multiple instances of H1 on many pages, which is semantically incorrect, as every page can only have a single H1 tag.

I have changed the H1 tags usage so that they are output only once, as per the context and WordPress's Frontpage settings under Reading sub-settings section of Settings.

What things are fixed?

  • Site title and description uses H1 & H2 tag only when on homepage
  • Page / Post titles are H1 on their individual pages, and not on archive pages
  • Assistive text are not H1 anymore
  • Widget titles are not H1 anymore

Tested with WordPress defaults and custom settings for Frontpage display, and now this outputs optimal markup in terms of semantics.

Since this will make pages output semantically correct data, this will also help in improving SEO.

@ashfame

This comment has been minimized.

Show comment Hide comment
@ashfame

ashfame Sep 9, 2012

Contributor

I see some reference to H1 being used as assistive text in small-menu.js:

$masthead.find( '.site-navigation h1' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );

But I don't understand what exactly it is doing, because without them, things appear to work just fine.

Contributor

ashfame commented Sep 9, 2012

I see some reference to H1 being used as assistive text in small-menu.js:

$masthead.find( '.site-navigation h1' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );

But I don't understand what exactly it is doing, because without them, things appear to work just fine.

@kovshenin

This comment has been minimized.

Show comment Hide comment
@kovshenin

kovshenin Sep 10, 2012

Contributor

It's an HTML5 semantics thing. @ianstewart has a neat response to why sections have h1 headings right here: #66 (comment)

It's also not "semantically incorrect" to have multiple h1's per page, and "every page can only have a single H1 tag" is also not true. It's just a couple of assumptions that SEO "experts" tend to make ;)

Contributor

kovshenin commented Sep 10, 2012

It's an HTML5 semantics thing. @ianstewart has a neat response to why sections have h1 headings right here: #66 (comment)

It's also not "semantically incorrect" to have multiple h1's per page, and "every page can only have a single H1 tag" is also not true. It's just a couple of assumptions that SEO "experts" tend to make ;)

@ashfame

This comment has been minimized.

Show comment Hide comment
@ashfame

ashfame Sep 10, 2012

Contributor

Interesting! I can swear I read this from a very authorative source, that one should have only single H1 tag on a page, as that represents what the page is about. I see, this has changed in HTML5 standards.

Found a good explanation here - http://www.seomoz.org/q/multiple-h1-tags-are-ok-according-to-developer-i-have-my-doubts-please-advise

And Matt Cutts also says its ok to have multiple H1 tags but not too much - http://www.youtube.com/watch?v=GIn5qJKU8VM

But still we are using a lot of H1(s) here. So, you think its OK to have that many H1 tags? I personally would still avoid the widget titles and assistive texts as such. Thoughts?

Contributor

ashfame commented Sep 10, 2012

Interesting! I can swear I read this from a very authorative source, that one should have only single H1 tag on a page, as that represents what the page is about. I see, this has changed in HTML5 standards.

Found a good explanation here - http://www.seomoz.org/q/multiple-h1-tags-are-ok-according-to-developer-i-have-my-doubts-please-advise

And Matt Cutts also says its ok to have multiple H1 tags but not too much - http://www.youtube.com/watch?v=GIn5qJKU8VM

But still we are using a lot of H1(s) here. So, you think its OK to have that many H1 tags? I personally would still avoid the widget titles and assistive texts as such. Thoughts?

@shawnsandy

This comment has been minimized.

Show comment Hide comment
@shawnsandy

shawnsandy Sep 10, 2012

Lets put the "semantics" aside for a while, view your theme with styles turned off, what your see is a lot of "headlines". That's what the search engines and basic browsers see, I just don't like it, semantics or not it makes no sense!!!

Lets put the "semantics" aside for a while, view your theme with styles turned off, what your see is a lot of "headlines". That's what the search engines and basic browsers see, I just don't like it, semantics or not it makes no sense!!!

@corvannoorloos

This comment has been minimized.

Show comment Hide comment
@corvannoorloos

corvannoorloos Sep 10, 2012

Contributor

According to whatwg.org: "Authors might prefer the former style for its terseness, or the latter style for its convenience in the face of heavy editing; which is best is purely an issue of preferred authoring style."

Having said that, I have to agree with @ianstewart's previous reply on this matter here.

Contributor

corvannoorloos commented Sep 10, 2012

According to whatwg.org: "Authors might prefer the former style for its terseness, or the latter style for its convenience in the face of heavy editing; which is best is purely an issue of preferred authoring style."

Having said that, I have to agree with @ianstewart's previous reply on this matter here.

@philiparthurmoore

This comment has been minimized.

Show comment Hide comment
@philiparthurmoore

philiparthurmoore Sep 10, 2012

Collaborator

See also: #8 (comment)

Collaborator

philiparthurmoore commented Sep 10, 2012

See also: #8 (comment)

@ianstewart

This comment has been minimized.

Show comment Hide comment
@ianstewart

ianstewart Sep 13, 2012

Contributor

Closing this one as we know it's not semantically incorrect.

Contributor

ianstewart commented Sep 13, 2012

Closing this one as we know it's not semantically incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment