Tagged: x
-
AuthorPosts
-
October 7, 2016 at 10:04 am #1206839
Hi,
I just discovered from talking with an seo expert that my H1 tags for all the pages on my site are just the name of my company. I need to fix this. I have H1 text lines at the beginning of each page as it is actually seen that correspond to specific target key words, however the first H1 reference at the top of the html markup of each page shows:<h1 class=”visually-hidden”>Name of my company</h1
This is bad for seo.
I use the yoast plugin for seo but was completely unaware of this problem. How do I fix this so the h1 tag is specific to the h1 text I entered in each page? I’m hoping I can make some global change so I don’t have to go back and do a change for each page…
thanks
October 7, 2016 at 7:28 pm #1207412Hi there,
Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
October 8, 2016 at 12:31 pm #1208103This reply has been marked as private.October 8, 2016 at 9:20 pm #1208440Hello There,
Thanks for updating in! To make the h1 correspond to the title of the page, please follow the following steps below:
1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
2] Insert the following code into that new file<?php // ============================================================================= // VIEWS/GLOBAL/_BRAND.PHP // ----------------------------------------------------------------------------- // Outputs the brand. // ============================================================================= $site_name = get_bloginfo( 'name' ); $site_description = get_bloginfo( 'description' ); $logo = x_make_protocol_relative( x_get_option( 'x_logo' ) ); $site_logo = '<img src="' . $logo . '" alt="' . $site_description . '">'; ?> <?php if ( is_home || is_front_page() ) : ?> <?php echo '<h1 class="visually-hidden">' . $site_name . '</h1>'; ?> <?php else : ?> <?php echo '<h1 class="visually-hidden">' . get_the_title() . '</h1>'; ?> <?php endif; ?> <a href="<?php echo home_url( '/' ); ?>" class="<?php x_brand_class(); ?>" title="<?php echo $site_description; ?>"> <?php echo ( $logo == '' ) ? $site_name : $site_logo; ?> </a>
And if you want it to remove the H1 tag completely, please use this instead:
<?php // ============================================================================= // VIEWS/GLOBAL/_BRAND.PHP // ----------------------------------------------------------------------------- // Outputs the brand. // ============================================================================= $site_name = get_bloginfo( 'name' ); $site_description = get_bloginfo( 'description' ); $logo = x_make_protocol_relative( x_get_option( 'x_logo' ) ); $site_logo = '<img src="' . $logo . '" alt="' . $site_description . '">'; ?> <a href="<?php echo home_url( '/' ); ?>" class="<?php x_brand_class(); ?>" title="<?php echo $site_description; ?>"> <?php echo ( $logo == '' ) ? $site_name : $site_logo; ?> </a>
3] Save the file named as
_brand.php
4] Upload this file to your server in the child theme’s folder
wp-content/themes/x-child/framework/views/global/
Hope this helps.
October 9, 2016 at 11:01 pm #1209352Hi,
Thanks for the advice. I added in the first file you mentioned but it did not fix the problem. I don’t want H1 to be “visually hidden.” I need it for seo purposes. I want H1 to be the same as the actual H1 that I enter in the text of the page, or the same as the keyword I enter in Yoast plugin.I found a page where they discuss this but I’m not sure how to do it. See
https://moz.com/community/q/yoast-seo-title-questionAt the very bottom someone recommends some code that should sink up the yoast title tag with the H1 tag for each page. Can you recommend how to use that code?
October 9, 2016 at 11:03 pm #1209354I meant “synch up” or “synchronize” not “sink up”
🙂October 10, 2016 at 2:17 am #1209479Hi there,
It doesn’t affect SEO even if it’s hidden. Your site will be penalized if you’re hiding the content to mislead or deceive your visitors. Example, if your site is about graphics but you hide the content related to medicine, gaining traffic.
Though, some SEO tool and expert are strict about it. That hidden h1 is for pages that don’t have titles and usually for the home page. Example, your home page is graphical and artistic, you wouldn’t want a big headline displaying on top of your site which kills the look and feel of your site design. Imagine all site’s home page has that large titles on every top of the content.
Still, you can remove it per your requirement and place anywhere you like. And the above procedure should do it, it’s two option and you can choose one.
About the syncing, it’s done through the_conten(). The procedure above (1st option) also includes that but instead of
<h1><?php the_title(); ?></h1>
,it’s added as
<?php echo '<h1 class="visually-hidden">' . get_the_title() . '</h1>'; ?>
But since you don’t wish it to be hidden, you can then change it to this
<?php echo '<h1>' . get_the_title() . '</h1>'; ?>
And it will display a big title along with the logo. OR simply use the last code (2nd option) and remove h1, then manually add your h1 through your home page content.
Syncing it with Yoast only applies to standard pages and posts by default, those standard pages and posts uses the_title() and get_the_title() (except pages with blank templates, they are intentionally made empty). And the main purpose of a home page is to compose and design it from scratch (no other design elements), it’s not good design practice to automatically display that big title. Still, it’s not restricted and users can still add titles through its content manually and remove the hidden one.
Thanks!
October 12, 2016 at 11:13 am #1213138Hi,
I tried the second option above. It seems to have removed the generic H1 tags on all my pages EXCEPT the homepage. The homepage still has it listed as “visually hidden.” Can you tell me how to adjust the code so I can get rid of that H1 tag on the homepage too?thanks.
October 12, 2016 at 7:49 pm #1213855Hi there,
I checked your page and I don’t see hidden
<h1>
anymore. But I do see this from your content which is added manually.<h1><span style="color: #ffffff;">HELPING THE INJURED</span></h1> <h1></h1> <h1><span style="color: #ffffff;">PROTECTING CONSUMERS</span></h1> <h1></h1>
You should try removing the other
<h1></h1>
, and use<h2></h2>
if you wish to have a second title.Thanks!
-
AuthorPosts