How can I add text on meta expr:content? - facebook-graph-api

I have a live streaming site, I am having trouble adding text to
<meta expr:content='data:blog.pageName' property='og:title'/>
I would like to put text before and after the data:blog.pagename data tag, so that it will show up in facebook as ( Watch "title of the post" Live Free ).
I am trying something like this below, but it is not working. Please help
<meta expr:content='Watch + data:blog.pageName + Live Free' property='og:title'/>
Here is my blogger website URL = https://www.nbalink.com/

You will need to enclose the text with double quotes ("). The following format will work
<meta expr:content='"Watch " + data:blog.pageName + " Live Free"' property='og:title'/>

Related

RegEx: Grabbing values with or without quotation marks

My Issue:
I am trying to grab Facebook meta value from different sites, but some website(usatoday.com) are not having appropriate HTML code. As you can see the data sample 1 & 2, so my question is how can I modify my regex expression code to get the value of the property and content.
What I've done:
With below if statement, I am kind of resolving the quotation mark issue (not dynamic enough), but I guess there must be a better way (I am really suck in regex)
Secondly, the regex I had not able to catch the content value(the url) in Data Sample 2 for usatoday.com, I guess the "" in the url mess up my regex.
Really need some help here, big thanks!
if(
preg_match( '/<meta(.*?)property="og:title"(.*?)content="(.+?)"(.*?)(\/)?>/', $raw_html, $matching )
// for normal sites
or
preg_match( '/<meta(.*?)property=og:title(.*?)content="(.+?)"(.*?)(\/)?>/', $raw_html, $matching )
// property no quote at all
or
preg_match( '/<meta(.*?)property=og:title(.*?)content=(.+?)(.*?)(\/)?>/', $raw_html, $matching )
// no quote at all
)
Data Sample 1 - no quotation mark on meta text attribute
# usatoday.com
<meta property=og:title content="Lakers trading Russell Westbrook in massive three-team deal with Jazz and Timberwolves"/>
# normal sites
<meta property="og:title" content="Lakers trading Russell Westbrook in massive three-team deal with Jazz and Timberwolves"/>
Data Sample 2 - no quotation mark on meta URL attribute
# usatoday.com
<meta property=og:url content=https://www.usatoday.com/story/sports/nba/2023/02/08/lakers-jazz-timberwolves-trade-russell-westbrook-mike-conley-dangelo-russell/11214855002/ />
# normal sites
<meta property="og:url" content="https://www.usatoday.com/story/sports/nba/2023/02/08/lakers-jazz-timberwolves-trade-russell-westbrook-mike-conley-dangelo-russell/11214855002/" />

Sharethis Twitter share image not loading

When using Sharethis to share a post from my website, the Twitter share button is unable to grab a dynamically generated image for the post. I have also included the link to the image in the head with "twitter:image" but the problem seems to persist. Any idea how to go around this?
this is an example of metatags to twitter in Django:
in between place:
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:description" content="Place your card description here"/>
<meta name="twitter:title" content="Card TITLE here"/>
<meta name="twitter:image" content="{{SITE_PROTOCOL_URL}}{% static 'location of the image in static files' %}"/>
where SITE_PROTOCOL
context = {
'SITE_PROTOCOL_URL': request._current_scheme_host,
}
In this LINK you can find the twitter card validator debugger
the content url for twitter:image in this example would be:
https://your-site.com/media/your_image_name.jpg
Hope I could help.
Note that will only work in a "live web" context

How can I avoid 'A product is missing a field: google_product_category' warning in facebook microdata debugger tool?

The tool
https://business.facebook.com/ads/microdata/debug
gives me the warning
Which OpenGraph tag can I use to fix the problem?
The HTML code like
<meta property="google:product:category" content="Pet Supplies"/>
or
<meta property="google_product_category" content="Pet Supplies"/>
doesn't work for me.
I have found the solution
the right format is
<meta property="product:category" content="Apparel & Accessories > Clothing > Dresses"/>
this work too... I used it for multi-languages pages and works fine, just set the ids from google in google_product_category list
<meta property="product:category" content="233"/>

Sitemap in Django - Titles don't show in google search

I have followed the steps in the documentation and it seems to be working as expected.
I have got an automated sitemap generated: https://duelify.com/sitemap.xml
Yet somehow there is no way to specify the title.
If I search in google for my site: site:duelify.com and scroll down I see the main site's title for every link:
Duelify | Duel Your Friends & Foes
https://duelify.com/topics/discuss/2/vegetarian-diet/
That doesn't look right.
If I try this with Stackoverflow:
site:stackoverflow.com django
Each entry has a proper title.
How could I achieve that? It is not clear from the given site map references.
The title displayed in Google search results has nothing to do with the sitemap.
Use meta (http://www.w3schools.com/tags/tag_meta.asp) and title tags:
<head>
<meta name="description" content="Your page description">
<title>Your page title</title>
</head>
And don't forget to set proper HTML heading tags.

Graph API post of video is not playable

I have an application that posts music videos from YouTube to a Facebook user's wall. The post on Facebook would have this embed video be playable from Facebook. Recently it stopped happening.
After some testing, it seems that when one makes the graph API post with the source being a YouTube video, then the link also needs youtube.com in the domain for it to be playable within a Facebook context.
To repeat:
You can take a look for yourself by logging into Facebook and going here:
https://developers.facebook.com/tools/explorer
Then get an access token with read_stream and publish_stream permissions (extended permissions tab).
Switch from GET to POST and set the endpoint to /me/feed with the following fields:
message = message
description = description
name = name
caption = caption
link = http://www.youtube.com/watch?v=r1dfEf1qOt4
source = http://www.youtube.com/e/r1dfEf1qOt4
picture = http://img.youtube.com/vi/r1dfEf1qOt4/0.jpg
It should show up on your Facebook wall and be playable.
Now do it again, but change the link to http://www.google.com.
It is no longer playable.
Can anyone confirm if this is expected behavior? I can't find anything in the Facebook docs. Perhaps I am just missing something?
Generalized Workaround
I generalized the answer to this similar question: posting a swf in facebook feed through facebook api. I created a page that takes two parameters and generates the necessary meta tags. Facebook accepts the link, the user is correctly redirected, and you don't need a separate page for each posted video.
url - the final URL
id - the id of the youtube or embedded video
I successfully made numerous embedded posts in which the link was not associated with the video.
Example Post
message = Post message
description = Post description if needed.
name = Post name
caption = Post caption
link = http://vbcopper.com/jsuar/so/fbembedvideo.php?url=stackoverflow.com&id=QGAJokcwBXI
source = http://www.youtube.com/e/QGAJokcwBXI
picture = http://img.youtube.com/vi/QGAJokcwBXI/0.jpg
PHP
<?php
$id = $_GET["id"];
$url = $_GET["url"];
if ( isset($url) ) {
echo <<< EOT
<html>
<head>
<title>$url</title>
<meta property="og:title" content="Page Title" />
<meta property="og:type" content="website"/>
<meta property="og:description" content="Content for Description" />
<meta property="og:image" content="http://i2.ytimg.com/vi/$id/mqdefault.jpg" />
<meta property="og:site_name" content="Content for caption"/>
<meta property="og:video" content="http://www.youtube.com/v/$id?version=3&autohide=1">
<meta property="og:video:type" content="application/x-shockwave-flash">
<meta property="og:video:width" content="640">
<meta property="og:video:height" content="360">
<META http-equiv="refresh" content="1;URL=http://$url">
</head>
<body>
</body>
</html>
EOT;
} else {
echo "Nothing here...";
}
?>
Findings
I was able to successfully replicate your issue. I could find no work around.
This has been submitted as a bug to Facebook but deemed low priority.
Bugs: Posting video to feed with link attribute doesn't embed the source
https://developers.facebook.com/bugs/502967809730190?browse=search_5074a2e48fd360934230075
Normally to share YouTube videos to Facebook pages you only need message, link, source,
picture parameters. Even you can also skip the source, picture parameters if you wish to. Thats is if you are using FacebookC#SDK to share video to Facebook all you need is following code
var fb = new Facebook.FacebookClient(yourPageAccessToken);
argList["message"] = message;
argList["link"] = "http://www.youtube.com/watch?v=" + specialOffer.YoutubeId;
argList["source"] = "http://www.youtube.com/v/" + specialOffer.YoutubeId;
argList["picture"] = "http://img.youtube.com/vi/" + specialOffer.YoutubeId + "/0.jpg";
fb.Post("feed", argList);
or
var fb = new Facebook.FacebookClient(yourPageAccessToken);
argList["message"] = message;
argList["link"] = "http://www.youtube.com/watch?v=" + specialOffer.YoutubeId;
fb.Post("feed", argList);