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
-
Old url is still indexed
A couple of months ago we requested a change of address in Search console. The new, correct url is already indexed. Yet when we search the old url (with site:www.) we find that the old url is still indexed. in Google Webmaster Tools the amount of indexed pages is reduced to 1. Is there another way to remove old urls?
Technical SEO | | conversal0 -
Search pages showing up as soft 404 in WMT
Hi ....we are getting allot of "site search" pages showing up in wmt as soft 404's and wanted to know what the best would be to stop this. All search pages are already noindex follow but maybe we should block them in robots txt as well. Would the below help to solve this ? User-agent: *
Technical SEO | | nomad-202323
Disallow: /?s=
Disallow: /search/ Any other suggestions or direction would be appreciated to prevent these pages showing up as soft 404's tks0 -
Is my knowledge graph code wrong?
I inserted the Knowledge Graph code on our site last week and am still not seeing the knowledge graph in our search results. Is something incorrect with my code? <script type="<a class="attribute-value">application/ld+json</a>"> { "@context" : "http://schema.org", "@type" : "Organization", "name" : "IssueTrak", "url" : "http://www.issuetrak.com/", "sameAs" : [ "http://www.facebook.com/issuetrak", "http://www.twitter.com/issuetrak", "http://plus.google.com/google.com/+Issuetrak"] } script>head> I suspect it is the alignment of the "{" and "}" but others in the company say that doesn't matter. Any other explanations for why the KG isn't showing in the results? Thanks I did test it with Google's Structured Data Testing Tool and got the "all's good."
Technical SEO | | Nobody15969167212220 -
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 -
Title Tags & Url Structure
So I'm working on a website for a client in the Tourism Industry. We've got a comprehensive list of museums & other attractions in a number of cities that have to go online. And we have to come up with the correct url structure, title tags and obviously content. My current line of thought was to work the urls in the following way. http://domain.com/type-of-attraction/city/name-of-attraction/ This is mainly because we think that the type of attraction is far more important then the city (SEO wise) as the country as a whole receives more searches, however we require a city in the url to make it unique because some attractions across cities happen to share names and we don't want to have the names of attractions littered with city names. However for title-tags I wanted to go the other way around, again due to the attraction type being more important then the city. Name of Attraction - Type of Attraction - City - Brand Name or Name of Attraction - Type of Attraction in City - Brand Name I am quite confident in working it this way; however I would appreciate if I receive some feedback on this structure, you think its good or you would make any suggestions / alterations. One last thing, There's the possibility of having many urls ending up with the same city names (For each type of attraction) I would think that just providing a list of links & duplicate text is not enough; would you suggest a canonical pointing to a link containing just information on the city? and using the other pages for user-navigation only? or should i set variables in the text which are replaced by the types of attraction so that the text looks different for each one?
Technical SEO | | jonmifsud0 -
How do i show my link xls file to google?
i have removed lots of links and contacted lots of webmaster to clean up my link profile. I have a large xls file to send to google for them to see that we have done a lot to clean up the bad links. How would i show this file to google? is there a place where I can post it? or email ? thank you nick
Technical SEO | | orion680 -
Non-Canonical Pages still Indexed. Is this normal?
I have a website that contains some products and the old structure of the URL's was definitely not optimal for SEO purposes. So I created new SEO friendly URL's on my site and decided that I would use the canonical tags to transfer all the weight of the old URL's to the New URL's and ensure that the old ones would not show up in the SERP's. Problem is this has not quite worked. I implemented the canonical tags about a month ago but I am still seeing the old URL's indexed in Google and I am noticing that the cache date of these pages was only about a week ago. This leads me to believe that the spiders have been to the pages and seen the new canonical tags but are not following them. Is this normal behavior and if so, can somebody explain to me why? I know I could have just 301 redirected these old URL's to the new ones but the process I would need to go through to have that done is much more of a battle than to just add the canonical tags and I felt that the canonical tags would have done the job. Needless to say the client is not too happy right now and insists that I should have just used the 301's. In this case the client appears to be correct but I do not quite understand why my canonical tags did not work. Examples Below- Old Pages: www.awebsite.com/something/something/productid.3254235 New Pages: www.awebsite.com/something/something/keyword-rich-product-name Canonical tag on both pages: rel="canonical" href="http://www.awebsite.com/something/something/keyword-rich-product-name"/> Thanks guys for the help on this.
Technical SEO | | DRSearchEngOpt0 -
Having both <title>and <meta name="title"...> on a web page?</title>
Hi All, Client of mine using reversed Meta Tags format in their website and Honestly i never saw such Meta Tags formats. In my opinion having 2 Title tags and wrong reversed description tag is not correct and the needs to be removed, and other tags need to be changed,too But they said that it probably doesn't make a difference because they don't think it affects search engine results and won't remove it just based on opinion. Because weird thing is Search Engines are apparently able to index them. So should i persist on correcting them or just hope for the best and ignore it?!?!?! Thanks!
Technical SEO | | DigitalJungle0