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
-
Are DA and PA still important?
I am quite vague about this concept, a few years ago it was quite effective and I used it to evaluate the quality of the website. But lately, I have a headache because some of the DA, PA pages are lower than my website (This keyword doing SEO: Intel core i9) but the rank is still higher.
Technical SEO | | yenu
Hope to be answered.
Thanks!0 -
SEO Title Length
Hi Everyone. I have a few pages being flagged with "Title Too Long". However, these are page 2, page 3, page 4, etc of category pages. They obviously have "| Page x of x" at the end of the title. Can these be ignored or is there a more SEO friendly way of handling this issue? Thanks. Michael
Technical SEO | | nomad_blogger0 -
Is <title>different from <h1> and "meta tag title"?</title>
hi guys, new to MOZ and SEO. Basic question here. is <title>different from <h1> and "meta tag title"?</p> <p>I have lots of "title missing or blank" errors as reported by a recent Moz crawl. What do i need to add into the pages to clear these? an <h1>? an <title>? or <meta tag title>? </p> <p>Im running a volusion site, and from what ive read (negative & positive) Volusion can be a pain to optimize my SEO as i dont have full access to all my pages.?</p></title>
Technical SEO | | Jerrion0 -
Page Title Displaying differently on Google
Hi i am wondering why page title is display differently on google search. The combination of words that are being displayed on google are not on the page and the page title is simply "Camera Filters", however the page is showing as "our range of Camera Filters" (with the same capitalisation). http://awesomescreenshot.com/0cf4r09y27 I have optimised the age as best i can so it removes the OUR RANGE OF preface, however no luck. Any info would be appreciated. Cheers
Technical SEO | | andrewlos0 -
Very strange: META descriptions not showing
Hello, Since Panda 4.0 has been launched, all of my optimized META description have been gone in Google.
Technical SEO | | MarcelMoz
A while ago, I posted a question about this problem here: http://moz.com/community/q/all-meta-descriptions-gone. I know about Google's own will to decide which META description will be shown. And also about unique content of the descriptions. All pages did have an optimized description before Panda 4.0 and there were no troubles at all, what tells me there is something else going on. I tested some things: Rewrote 50 descriptions to very uinique ones, only five got indexed. This tells me that duplicate content of the descriptions is not the problem (they have never been 100% duplicate, product type was a variable which was always different for each page). Removed cache in GWT and fetched again as Google, didn't help. I checked the pages I tested and they all have been indexed again without showing the optimized descriptions. More information: The first time I changed some META descriptions and fetched the pages again in GWT, Google picked up my new META descriptions and showed them. A few days later, most of them disappeared again (so Google is aware of the description but seems to ignore it). Some pages show the optimized description when I change my search query (only a few, mostly the optimized description never got shown) Technique is ok. Source code shows the right optimized description. META robots isn't blocking anything except NOODP/NOYDIR (always has blocked those). Websites using the exact same CMS, website template, META descriptions (style and build-up), do not have these problems I compared elements like place of description in source code, usage of meta robots, og:description, crawl-delay in robots.txt, and special characters in descriptions between websites that are showing optimized vs. website that don't show optimized descriptions. I can't find any connection. Something I noticed is a change is my Robots.txt file: my webmaster has added the following command:
Crawl-delay: 2 May this have to do with my problem? I guess it doens't. I did some research and there are more websites that are suffering this problem beside mine. This tells me it must be Google (and so Panda 4.0) that is responsible for this change. I realy want my optimized descriptions back. Does anybody have an idea what to do?
Thanks in advance. Marcel0 -
Bars Verus Hyphens in Title Tags
It has been quite a while since I have seen an article really talk about this and I am wondering if this even matters anymore? I prefer the look of a - rather than a | but just wondering if this is still a thing... If you know of a recent article going into findings on this supporting one or the other it would be appreciated. Thanks!
Technical SEO | | DRSearchEngOpt0 -
What coding works for SEO and what coding doesn't?
Hi: I recently learned about inline styles and that Google started penalizing sites for that in October. Then I was told that Wix and Flash don't work (or work well) either for SEO as the engines won't crawl them (I think). Does anyone know of a blog that goes over everything that doesn't work so that I could recognize it when I look at someone's code. Anyone know of such a resource? Cheers, Wes
Technical SEO | | wrconard0 -
No crawl code for pages of helpful links vs. no follow code on each link?
Our college website has many "owners" who want pages of "helpful links" resulting in a large number of outbound links. If we add code to the pages to prevent them from being crawled, will that be just as effective as making every individual link no follow?
Technical SEO | | LAJN0