How to make my site title H1?
-
Hi
In my Header.php I have the following php code for my title:
<title><br /><?php<br />// Generate Page Title dynamically<br />if (is_home()) {<br /> bloginfo('name'); ?> - <?php bloginfo('description');<br />} elseif (is_category()) {<br /> single_cat_title(); ?> - <?php bloginfo('name');<br />} elseif (is_single()) {<br /> single_post_title();<br />} elseif (is_page()) {<br /> bloginfo('name'); ?>: <?php single_post_title();<br />} elseif (is_404()) {<br /> bloginfo('name'); ?> - <?php _e("Page not found", "fungames");<br />} elseif (is_search()) {<br /> bloginfo('name'); ?> - <?php _e("Search results for", "fungames"); echo esc_html($s, 1);<br />}<br />?><br /></title>
This generates a good title different for every page/post I have on my site. But is now H1. I want the same code if, but with H1 tag somewhere in it. Cant figure it out how to do it!
Can u help please?
-
Here is what I use in the PHP files for pages and posts on my Wordpress sites:
class="entry-title post-title">Name of Website Page
Note: I don't think I've ever seen someone put the page title in the header file. You may want to move it to the template files for posts/pages.
In your case, though, it may work just to put an H1 tag at the beginning and end of the whole thing:
<title><br /><?php<br />// Generate Page Title dynamically<br />if (is_home()) {<br /> bloginfo('name'); ?> - <?php bloginfo('description');<br />} elseif (is_category()) {<br /> single_cat_title(); ?> - <?php bloginfo('name');<br />} elseif (is_single()) {<br /> single_post_title();<br />} elseif (is_page()) {<br /> bloginfo('name'); ?>: <?php single_post_title();<br />} elseif (is_404()) {<br /> bloginfo('name'); ?> - <?php _e("Page not found", "fungames");<br />} elseif (is_search()) {<br /> bloginfo('name'); ?> - <?php _e("Search results for", "fungames"); echo esc_html($s, 1);<br />}<br />?><br /></title>
I hope this may help -- good luck!
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
We redesigned our website, make it responsive and page views tanked. What happened?
Last year, we redesigned our site and made it responsive. Our page views only grew by only 3% (the previous year they grew by 40%). If we exclude homepage views from our calculations, we get a drastically different picture-- and see over 30% growth for both total and unique pageviews. Any thoughts?
Web Design | | Anna720 -
New ecommerce site: Close old site and full domain redirect or keep it linking to new site?
We have rebranded and are working on our new site (B). Our old site (A) has a much higher domain/page authority than our new site. Currently we have the original Site A still there, with all links/pages pointing to the new Site B when people click. I am unsure whether we'd be best to close down the Site A completely and do a full domain redirect to Site B. Site A: 10 years age and has a moderate amount of links to it.
Web Design | | ModowestNZ
Homepage - PA: 24 DA:11 Site B: 6 months age, few links
Homepage - PA: 1 DA:2 My concern with the full domain redirect is that the indexed/ranking pages would dissapear. The benefit is less brand confusion for our niche range of party accessories.0 -
Multiple Similar Product Variations - Page layout, Title and SEO best practice??
Im doing some research into SEO for our new web design. I sell designer eyewear prescription and sunglasses. Lets take a Ray Ban Wayfarer sunglass it comes in 30 colours and 3 sizes for each model. Up till now i was of the impression that for best practice SEO i would need to have each individual variation as its own page, this would also help with things like google shopping too. So for example heres 1 colour product in 3 sizes of 30 colour variations for this particular model. Ray Ban Wayfarer RB2140
Web Design | | Craigboi1987
Colour: Black 901
Sizes: 47, 50, 54 Currently my urls looks like this with a new page and the size changing on the end for each variation. Ray Ban Wayfarer RB2140 - Black 901 - 47 URL: www.mywebsite.com/ray-ban-wayfarer-rb2140.html?colour=Black+901&size=47 Ray Ban Wayfarer RB2140 - Black 901 - 50 URL: www.mywebsite.com/ray-ban-wayfarer-rb2140.html?colour=Black+901&size=50 Ray Ban Wayfarer RB2140 - Black 901 - 54 URL: www.mywebsite.com/ray-ban-wayfarer-rb2140.html?colour=Black+901&size=54 This is very time consuming and I'm not sure if its adding any benefit to my SEO in fact scared its actually a) slowing my site down (content heavy)
b) looking like duplicate content I am thinking about moving towards a page more like this were it would be just be a model with variations. (not effecting the title/getting a new page per variation) http://demoleotheme.com/vigoss/index.php/atomic-endurance-running-tee-crew-neck.html I am not sure of the pros and cons of doing it this way over the way I'm doing it currently all i know is my site is ranking horribly. Lastly I'm currently running a magento V1.9 store which is renowned for duplicate content slow site speeds etc so have been told moving to woo commerce would benefit me for both site performance and seo but I'm skeptical as currently with this structure of a each SKU being a new page il be up to 8000+ products and multiple product variations that it can handle my needs, anyone with any experience on woo commerce platform? (this might be a operate question apologise) This is absolutely frying my brain so any advice appreciated. Im prepared to put every dying second into just need some solid advice in which direction to go!0 -
301 Redirect all pictures when moving to a new site?
We have 30,000 pictures on our site. Moz will return 404's on some occasionally, but Google seems to ignore those. Should I 301 redirect all those images when we move to a new site lay-out? Appreciate your views!
Web Design | | Discountvc0 -
Web Hosting and CDN for Wordpress Site Load Speed - Suggestions Needed
We all know that website load speed is more important than ever. While I love the look and feel of parallax and Wordpress, I want to do everything I can to keep the load speed down. I see a lot of conflicting information regarding web hosting services, CDN services and other service (Cloudflare for example). I am looking to hear from those with their own experiences to let me know what they think is the ideal setup for a parallax Wordpress site is as far as which services to use, including: 1. Web Hosting
Web Design | | Gauge123
2. CDN
3. Any other service or product that would help to provide and extremely fast site load time. Thank you!0 -
Thoughts on our Agency Site
Hi all, We'd all welcome opinions on our digital agency site http://www.newbrandvision.com/. We are in the planning stage of launching a new site; and we'd welcome any UX or SEO thoughts. It's a strange one but our agency has been around since 2002, and we operate in the heart of London; however we don't rank anywhere near the first page for "digital agency in London" or any long-tail /semantics around this. We feel that it's pretty clear from search and when landing on the site what we are; but would welcome any general thoughts as to why we aren't ranked that highly. Much appreciated!
Web Design | | Tangent0 -
URL Designing and Site Architecture
Hi, 1. At the end of the URL, should we have "/" or not (for e.g. my website www.example.com/abc/) 2. What is the optimum level of site depth 3. Google crawler will go through the breadcrumb or url (If a page is at 6th level through breadcrumb and at 4th level through URL, at which level will google crawler recognize this.
Web Design | | adiez12340 -
Changing H1 Tag based on referrer
Hello, I need some quick help and advice. We're going through a website re-design, and we have a few H1 tags set on some of our inner pages. The team is ok with these, however they want to change the H1 tag if the user gets to that page from a page within the site. Example:
Web Design | | uSell
When the referrer is our site (www.domain.com), the H1 tag = Go to Step 2 When the referrer is anything else, the H1 tag = Welcome to our site I'd like to keep the H1 tag as the SEO rich keyword text we agreed on (in this case "Welcome to Our Site"), however our developers don't think its directional enough and wants to change it based on the user path. I'm ok with the suggestion, however I want to make sure that if we choose the option with the referrer that this doesn't impact our SEO efforts. I'm assuming the referrer will changed based on how the bot gets to the page, but i'm not certain and was wondering if anyone had some thoughts on this.. Any help is greatly appreciated. Thanks...0