Why are apostrophes and other characters still showing as code in my titles?
-
Hi,
I have a WordPress-based site and overall everything is working well. However, I can't seem to figure out how to get apostrophes and other characters to display normally.
Now, the problem isn't that they are displaying as code to normal visitors or up in the title bar, they are displaying as code to Google's bots as well as to SEOMOZ.
Example:
Normal visitor sees:
About **** | **** - Metro Vancouver's IT & Web Experts
Google and SEOMOZ see:
About **** | **** - Metro Vancouver's IT & Web Experts
I've played around with different ways of typing the title (not using character codes vs. using character codes) and nothing seems to work.
Any help or explanation would be appreciated.
-
Gabriel-
It's no problem for these codes to appear in other sections of the page. There are many character sets out there, and what may appear great to you (without codes) looks like gibberish to someone else. The codes help make for a uniform experience for everyone. For instance, there are no "smart quote" keys on your keyboard, yet some programs (like Word) will automatically insert these for you. To have these on a web page most systems will convert these to codes for you. The ampersand, however, falls into this category since it's often an escape character for other characters.
So, the place we're still really most concerned about is the meta title. I'm not sure why the mb_convert_encoding() function didn't work for you?
If you'd like me to take a closer look feel free to message me. This is solvable - I've done it before on WP sites.
-
One more thing - I've noticed that Google, SEOMOZ, and Firefox's View Source all show apostrophes, ampersands, and other characters as code not just in the title tag but also throughout the body of the page - so it is a general problem.
-
I actually removed site caching because it was causing some problems. But yes, I had it on previously.
I'm wondering if the wordpress function - wp_texturize - is doing something funny to the titles...
-
Gabriel-
Do you have some sort of site caching turned on?
-
Fixed some of the other issues with my site (had a bunch of white spaces in my php files) but this is still not working. I inserted your code and it doesn't break anything, but it doesn't work either from what I can tell...
-
Gabriel, I think we're close here... give this a try:
<title></p> <p><?php wp_title('«', true, 'right'); ?></p> <p><?php echo mb_convert_encoding(get_bloginfo('name', 'display'), 'UTF-8', 'HTML-ENTITIES'); ?></p> <p></title>
-
Okay, I found the line:
<title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
And I tried inserting your code multiple ways but now Fetch as Googlebot is saying the site is unreachable. I've reversed but still get same problem...
Strange stuff.
-
Look in your header.php file. Here's what the <title>tag code might look like. Again, you may need to wrap the mb function around more than one piece. This should get you started.</p> <blockquote style="color: #5e5e5e; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f7f7f7; padding-top: 5px; margin-left: 0px; padding-left: 2px; padding-bottom: 5px; white-space: nowrap; overflow-y: auto; font-family: monospace; background-position: initial initial; background-repeat: initial initial;"> <p><span style="color: #5e5e5e;"><title><?php</span></p> <p><span style="color: #5e5e5e;"> </span><span style="color: #5e5e5e;">/*</span><span style="color: #5e5e5e;"><span> </span>Print the <title> tag based on what is being viewed.</span><span style="color: #5e5e5e;"><span> </span> */</span></p> <p><span style="color: #5e5e5e;"> </span><span style="color: #5e5e5e;">global $page, $paged;</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">wp_title( '|', true, 'right' );</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">// Add the blog name.</span><span style="color: #5e5e5e;"><span> </span>bloginfo( 'name' );</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">// Add the blog description for the home/front page.</span></p> <p><span style="color: #5e5e5e;">$site_description = mb_convert_encoding(get_bloginfo( 'description', 'display' ), 'UTF-8', 'HTML-ENTITIES');</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">if ( $site_description && ( is_home() || is_front_page() ) )</span></p> <p><span style="color: #5e5e5e;"><span style="white-space: pre;"> </span>echo " | $site_description";</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">// Add a page number if necessary:</span></p> <p><span style="color: #5e5e5e;">if ( $paged >= 2 || $page >= 2 )</span></p> <p><span style="color: #5e5e5e;"><span style="white-space: pre;"> </span>echo ' | ' . sprintf( __( 'Page %s', 'oldheidelbergdeli' ), max( $paged, $page ) );</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">?></title>
-
Thanks for looking into this. Approximately where would I place this code?
-
This worked for me....
$site_description = mb_convert_encoding(get_bloginfo( 'description', 'display' ), 'UTF-8', 'HTML-ENTITIES');
The text is getting encoding in the second half of your meta tag, so if you convert the encoding you should be able to get around this. You may need to apply this to several sections of that depending on what's going on... check the tag out on several pages.
Let me know how it works out.
-
Well what would be the html entity code for a standard apostrophe. And even if that is solved, the & is still not displaying correctly.
I've searched many forums for the answer but nothing seems to be coming up!
-
Hi Gabriel,
' Looks like an html entity code for some non-standard apostrophe. Not sure why though, it looks normal. Your apostrophe might need to be changed to a single quote instead.
-
I've done what you've said and this is what I've come up with:
<title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
Does anything look odd?
-
Ahh, you are right about the first ampersand. You should probably take a look at the wp_title() function and see if it's doing any html_special_chars filtering. Again, if nothing else seems to work, you could change up the "and" remove the possessive on Vancouver.
-
Thanks for the quick reply. I tried doing that but not luck. The odd thing is that using Google's Webmaster tools, I see that the meta title and some of the headings have the code in them whereas other body text doesn't. Either way, I need to resolve this.
I tested a page and here are a couple of lines:
<code><title>IT & Web Services | **** - Metro Vancouver's IT & Web Experts</title> Odd how the first & (and) looks fine whereas the second doesn't.</code>
-
Hey Gabriel-
Quick and dirty... you could change the meta title to Function 5 - Metro Vancouver IT and Web Experts.
Have you tried putting the full & in the meta title? There might be a double-conversion issue going on there.
-John
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
-
Top domain(s) not at all showing up for branded keywords
Hey guys! Hope you're all doing well. I need your smart brains for a problem the company I work for is currently facing in the realm of SEO. They wanted to hire someone to find the problem, but I thought I would reach out to you guys, first, to at least try and narrow down the long list of things we could look at/investigate. I put the info (briefly) on 3 slides, and would really appreciate any and all insights you can offer me: https://docs.google.com/presentation/d/12d0YH7BNdCIpJ86d95uBOtOWphWQ3NB1kwDYeOzIt-U/edit#slide=id.g19145c9fa5_0_0 Thank you in advance!
Technical SEO | | michelledemaree0 -
Duplicate Title Tags How harmful is it?
I recently updated a site to use a new WordPress theme. This theme in conjunction with Yoast SEO plugin is causing duplicate Title tags. The tags have the same title in them. I discovered this when adding new keywords and pages to the page optimizer in moz. I have since turned off moz to stop the duplicate title tag issue however I am wondering if tuning off yoast is worse then the duplicate title tags. Any clarification on the duplicate page title issue and its consequences would be greatly appreciated.
Technical SEO | | donsilvernail0 -
Does Title Tag location in a page's source code matter?
Currently our meta description is on line 8 for our page - http://www.paintball-online.com/Paintball-Guns-And-Markers-0Y.aspx The title tag, however sits below a bunch of code on line 237 Does the location of the title tag, meta tags, and any structured data have any influence with respect to SEO and search engines? Put another way, could we benefit from moving the title tag up to the top? I "surfed 'n surfed" and could not find any articles about this. I would really appreciate any help on this as our site got decimated organically last May and we are looking for any help with SEO. NIck
Technical SEO | | Istoresinc0 -
Why are my page titles not being honored?
If you view source you will see my actual title tag http://www.sqlsentry.com/products/performance-advisor/sql-server-performance The google results are showing a completely different title tag that we do not want used. This was working properly and I'm not understanding how it got changed. Thanks!
Technical SEO | | Sika220 -
HELP: Wrong domain showing up in Google Search
So i have this domain (1)devicelock.com and i also had this other domain (2)ntutility.com, the 2nd domain was an old domain and it is not in use anymore. But when i search for devicelock on Google, the homepage devicelock.com does not exist. Only ntutility.com comes up. I asked one of the developer how the redirect is happening from the old domain to the new one and he told me its through a DNS forward. And there is no way to have an .htacess file to set up a 301 instead. Please help!
Technical SEO | | Devicelock0 -
Google not showing profile photo in search
I seen on google snippet review and it was showing profile photo in search but when i see directly on google.com it is not showing there.. what's the problem ?
Technical SEO | | xplodeguru0 -
Coding - where to start?
I've been working in digital marketing for a few years and over the past 2, I've concentrated on getting my head around (or trying to!) the world of SEO. Everything from reading this forum, listening to webinars and re-reading the beginners guide to SEO has provided me with the confidence to put in actionable insights into my work such as on page optimisation, keyword research, link build and passing this knowledge onto co-workers However, one area I am beginning to realise is just as important is having the ability to code for yourself. Can anyone out there point me in the right direction of where to start, what I program I should concentrate on? and what I shuld focus my energies on? Any help would be great Simon
Technical SEO | | simonsw0 -
Double byte characters in the URL - best avoided?
We are doing some optimisation on sites in the APAC region, namely China, Hong Kong, Taiwan and Japan. We have set the url generator to automatically use the heading of the page in the URL which works fine for countries using Latin characters, but is causing problems, particularly in IE, when it comes to the double byte countries. For some reason, IE struggles with double byte and displays URLs in their rather ugly, coded form. Anybody got any suggestions on whether we should persist with the keyword URLs or revert to the non-descriptive URLs for the double byte countries? The reason I ask is it's a balance of SEO benefit vs not scaring IE users off with ugly URLs that look dreadful and spammy.
Technical SEO | | Red_Mud_Rookie0