I am trying to customize the $head variable in my page.tpl.php template, because there are two instances of
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
appearing, which I believe is affecting the site from being validated using W3C's Markup Validation Service. Any help would be much appreciated, thanks!
Well, first of all I'd try and figure out WHY you're getting duplicates of that. Manually removing one is more of a hack than a fix.
That said, you can customize $head using template_preprocess_page. In your theme's template.php, do something like:
<?php
function THEMENAME_preprocess_page(&$variables) {
// use $variables['head'] here and do whatever you want with it, such as...
$variables['head'] = str_replace('blah blah','blah',$variables['head']);
// ...although that's completely untested and might not work
}
This seems to be a bug in the Drupal API, the discussion can be followed here:
http://drupal.org/node/451304#comment-2632954
Seems that even drupal.org is duplicating the content type meta tag.
Related
I use to implement Facebook's OpenGRaph protocol on my pages (wordpress) based on All In One SEO plugin.
With each page:
<meta property="og:type" content="article">
<meta property="og:title" content="my_title">
<meta property="og:url" content="http://my_site.jp">
<meta property="og:description" content="my_content">
<meta property="article:published_time" content="my_published_time">
<meta property="article:modified_time" content="my_modified_time">
<meta property="og:site_name" content="my_site_name">
<meta property="og:image" content="http://my_site.jp/wp-content/uploads/2017/05/my_image.png">
<meta property="og:image:width" content="600">
<meta property="og:image:height" content="315">
<meta property="og:locale" content="my_cocale">
But i get these error when checking with Facebook developer debug:
URL returned a bad HTTP response code.
Inferred Property
The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags.
I have ref from: Facebook Open Graph Error - Inferred Property
But I don't have any solution. Have your solution for this problem?
Since your initial link's image issue is now fixed, it's difficult to say what was wrong with it, especially since the snippet you provided seems fine. With the latter link you provided, though, I'm getting this error:
The 'og:description' property should be explicitly provided, even if a value can be inferred from other tags.
This is because there isn't an explicitly og:description tag available on the page.
Someone unrelated: I'm noticing duplicate twitter:card and related tags. This shouldn't cause Open Graph to not work, but should be resolved.
My hunch is that you're using multiple plugins that might be providing the same thing, causing clashes and unexpected behavior. This is why I tend to stay away from "provide it all" plugins, and instead use plugins that do one thing and one thing well. In your case, this might mean using a simpler, more predictable plugin like Complete Open Graph:
https://wordpress.org/plugins/complete-open-graph/
I'm pulling my hair out on this one. I'm trying to share my ASP.Net Web Forms site on Facebook, but the preview doesn't show the Image or Description I have set up. I found this chunk of code that's supposed to do the trick. I put it in my MasterPage, but it just isn't working:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
<head id="Head1" runat="server">
<title>MySite</title>
<meta property="og:url" content="http://www.example.com" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Your Website Title" />
<meta property="og:description" content="Your description" />
<meta property="og:image" content="http://www.example.com/img/fbbanner.jpg" />
...
According to Facebook's Sharing Debugger,
The 'og:image' property should be explicitly provided, even if a value
can be inferred from other tags.
...but, hell if I know what that's supposed to mean. What's funny is, if I remove the meta tags out entirely, I get the same error. When I click on "See exactly what our scraper sees for your URL," I see the meta tags in the rendered code... I'm at a total loss. I can't find an article or an answer that was written in the past several years, so I have a feeling the information I'm getting is outdated. I just can't figure out the magic words...
Update Now, suddenly it works fine. I just clicked "Scraped Again" after I posted this, and it seems to be working. I don't really get it... :(
if you are using any cache plugin, make sure you clear all your caches. Also make sure the image you are using has the recommended facebook size: 1200(w) x 630(h) or 600 x 315. If not it will choose randomly some of your images in the website that are suiting the facebook needs. Read more here
I don't know what else to try; each time I render a twig template, I get those symbols:
�
Instead of "á" for example.
Each template, extends a "base" template, which cointains:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
But that symbol is still shown. I checked sourcecode of the page rendered, and that meta tag line appears there.
Is there any global configuration I've to set to avoid this?
Thank you!
Edit: Note that I'm using TWIG. Maybe some Twig parameters are missconfigured?
You should use à, see the html special characters
To do this dynamically: look at the php function htmlspecialchars()
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How does Facebook Sharer select Images?
I'm trying to use Facebook Comments on a Drupal website correctly. The comment box shows up and works exactly as I want it to, but when I go to facebook debugger http://developers.facebook.com/tools/debug it tells me that none of the required open graph meta tags (og:title, etc.) are set. It's not recognizing any of the meta tags, which also means I can't use the fb:admins tag to moderate comments.
My problem sounds very similar to this one: Missing og meta tags when running debug but I manually set the Content-Length parameter using PHP and the meta Tags still are not being recognized by facebook. I'm running PHP 5.2.9, and I have NO access to upgrading or editing it at all. (University environment, they're a trifle slow and obfuscating when asking for server changes.) I've found multiple questions on Stack Overflow along similar lines, and have tried implementing all the suggested fixes to no avail, any help would be appreciated!
Please let me know if I left out any needed info! I'm getting quite frustrated here, it took about 3 minutes flat to get the facebook comments to work, and now hours and hours of work still haven't resolved this issue. . .
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://opengraphprotocol.org/schema/"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title><?php print $head_title ?></title>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<meta property="fb:app_id" content="{my app id}" />
<meta property="fb:admins" content="{my facebook id}"/>
<meta property="og:title" content="<?php echo $title; ?>" />
<meta property="og:type" content="sports_team" />
<meta property="og:url" content="<?php echo $url; ?>" />
<meta property="og:image" content="http://example.com/logo-200.jpg" />
<meta property="og:site_name" content="Site Name" />
Putting those meta tags on my page worked so I think you have the tags correct.
http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fpaulisageek.com%2Ftmp%2Fso_7517794.php
Maybe you are issuing content before the <head>? Or your webserver isn't responding well to an HTTP query with a Range: header? Check your access logs for the exact query Facebook is making to see what to test.
i want to change the SearchForm.php file in my wordpress themes to hebrew.
i mean i want to see 'חפש' (hebrew text) instead of 'search for '.
when i change it i see gebrish.
why ??
thanks.
You need to make sure that the content-type of the page is the correct one - normally UTF-8 would work for all languages.
You can use a meta tag within the head element:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
For Hebrew it is iso-8859-8.
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-8">
This is normally already setup within the template and you can look at your settings to see if it is correct - In Settings -> Reading, under "Encoding for pages and feeds".
You also need to be sure that the page is saved as UTF-8 and not ascii - check your text editor settings.