When I invoke facebook javascript to implement payment feature, I always got the error code: 1383146, and error_message: "invalid og type. Expected og:product, got website".
The code is copy from facebook example:
function buy() {
var obj = {
method: 'pay',
action: 'purchaseitem',
product: 'https://xxxxxx/test3.html'
};
FB.ui(obj, function(data) {
console.log(data);
});
}
The test3.html:
<!DOCTYPE html>
<html>
<head prefix=
"og: http://ogp.me/ns#
fb: http://ogp.me/ns/fb#
product: http://ogp.me/ns/product#">
<meta property="og:type" content="og:product" />
<meta property="og:title" content="The Smashing Pack" />
<meta property="og:description" content="A smashing pack full of items!" />
<meta property="og:image" content="http://www.friendsmash.com/images/pack_600.png" />
<meta property="og:url" content="http://www.friendsmash.com/og/smashingpack.html" />
<meta property="product:price:amount" content="2.99"/>
<meta property="product:price:currency" content="USD"/>
<meta property="product:price:amount" content="1.99"/>
<meta property="product:price:currency" content="GBP"/>
</head>
</html>
Related
I am new to programming.
My question is the following:
Is there some kind of template for subpages, for example on the homepage of the website.
I would like to create a few sub-pages that have the same structure, but deal with a different topic.
Is there something I can read into or something I can find out about?
PHP is a programming language and it is also a template engine. There are several ways to tackle the problem you have outlined.
Index.php would look like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Hello</h1>
<div>Lions</div>
<div>Narwhals</div>
<div>Chimps</div>
<div>Hawk</div>
</body>
</html>
topic.php
<?php
class TopicData
{
// Use a static function to get the data for a keyword
public static function text($keyword){
$file = "topics.json";
// If the file doesn't exist, just say there is no data
if ( ! file_exists($file) ) {
return "No information on topic";
}
$topics = json_decode(file_get_contents($file));
$text = $topics->{$keyword} ?? "No information on topic";
return $text;
}
}
$text = TopicData::text($_GET['a']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div style="">
<?= $text ?>
</div>
</body>
</html>
topic.json
I use a json file to store some test data.
{
"lions": "Lions go here",
"narwhals": "Narwhals have tusks",
"chimps": "Chimps can't read",
"hawk": "Hawks fly iini the day time"
}
hi i am trying to convert my html code into an image
this i my python code:
def cnv2image():
options = {
"--enable-local-file-access": None,
"--enable-javascript": None,
"--javascript-delay": 10000,
"--debug-javascript": None
}
imgkit.from_file("tweet_embed.html", "result.pdf", options)
and this is my html code:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
name="viewport">
<meta content="ie=edge" http-equiv="X-UA-Compatible">
<meta content="text/html; charset=utf-8" http-equiv="Content-type">
<meta content="jpg" name="imgkit-format">
<script async charset="utf-8" src="https://platform.twitter.com/widgets.js"></script>
<title>Document</title>
</head>
<body>
<blockquote class="twitter-tweet" data-theme="dark"><p dir="ltr" lang="en">be honest, do you kiss your dog goodnight?</p>— ᴘᴀᴠʟᴏᴠ ᴛʜᴇ ᴄᴏʀɢɪ 🐶 (#PAVGOD) August 18, 2021</blockquote>
</body>
</html>
the problem is that when i try to convet html to image js wont get load and i get a screenshot only from html
this is the result that i get:
this is what i expect:
I am trying to share images and video on social media ( mostly FB,twitter,linkedIn )in reactjs app , have added react-helmet for the same but still unable to share image below is the link which i am referring and my code.
https://medium.com/camperstribe/react-social-media-integration-with-react-share-and-react-helmet-84d9def6a445
Above solution is not working
import React from "react";
import { Helmet } from "react-helmet";
// import { useLocation } from "react-router-dom";
export default function HelmetMetaData(props) {
// let location = useLocation();
let quote = props.quote !== undefined ? props.quote : "";
let title =
props.title !== undefined
? props.title
: "CampersTribe - World is yours to explore";
let image =
props.image !== undefined
? props.image
: "https://images.unsplash.com/photo-1576091160550-2173dba999ef?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2850&q=80";
let description =
props.description !== undefined
? props.description
: "CampersTribe lets you experience the camping culture. We discover the hidden gems in the nearby to help you connect with nature & yourself by learning in the woods, on the riverbank under the open sky." +
"Trust us, its million dollars experience to ride away from city life, pitch a tent, do campfire and endless talk!" +
"So, join us on this voyage, and explore the beauty and miracle of being yourself!";
let hashtag = props.hashtag !== undefined ? props.hashtag : "#camperstribe";
return (
<Helmet>
<title>{title}</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="csrf_token" content="" />
<meta property="type" content="website" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png" />
<meta name="theme-color" content="#ffffff" />
<meta name="_token" content="" />
<meta name="robots" content="noodp" />
<meta property="title" content={title} data-react-helmet="true"/>
<meta property="quote" content={quote} data-react-helmet="true"/>
<meta name="description" content={description} data-react-helmet="true"/>
<meta property="image" content={image} data-react-helmet="true"/>
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />
<meta property="og:title" content={title} />
<meta property="og:quote" content={quote} />
<meta property="og:hashtag" content={hashtag} />
<meta property="og:image" content={image} data-react-helmet="true"/>
<meta property="og:image:secure_url" content={image} data-react-helmet="true"/>
<meta content="image/*" property="og:image:type" data-react-helmet="true"/>
<meta property="og:site_name" content="CampersTribe" />
<meta property="og:description" content={description} />{" "}
</Helmet>
);
}
i have created helmetMetaData component and calling in top of my social share component
return (
<div className="app-content content">
<HelmetMetaData />
<FacebookShareButton
windowWidth="800"
windowHeight="500"
url={
"https://images.unsplash.com/photo-1576091160550-2173dba999ef?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2850&q=80"
}
quote={"test sharing"}
image={
"https://images.unsplash.com/photo-1576091160550-2173dba999ef?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2850&q=80"
}
imageURL={
"https://images.unsplash.com/photo-1576091160550-2173dba999ef?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2850&q=80"
}
// hashtag="#camperstribe"
// className={classes.socialMediaButton}
>
<FacebookIcon size={36} />
</FacebookShareButton>
)
but not working only getting url and title on facebook share dialog,
anybody knows how to share image on social media in reactjs?
I know it's an old question, but try to insert image meta tag directly into public/index.html. As it said in this issue: adding meta on client side dynamically does not work. Crawlers (fb, tw, etc) can see only static html. And it seems like FacebookShareButton doesn't have image as an optional prop.
i will create a Checkout system for gastro.
How i can wríte this.
I will create a list than write this on another page "home.php",
than i need a script were i can onclick writeout "deftige KartoffelSuppe" and the price.
i love you guys,
<script>
let Suppe =["Deftige Kartoffelsuppe, 4,80"];
</script>
<button id="btn0">Deftige Kartoffelsuppe</button>
<div id="Ausgabe"></div>
Greedings from Germany
Michael Burat
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Static Template</title>
</head>
<body>
<button id="btn0">Deftige Kartoffelsuppe</button>
<div id="ausgabe"></div>
<script>
let suppe = ["Deftige Kartoffelsuppe, 4,80"];
const btn = document.querySelector("#btn0");
const ausgabe = document.querySelector("#ausgabe");
btn.addEventListener("click", () => {
ausgabe.innerHTML = suppe;
});
</script>
</body>
</html>
i changed the id names to lowercase and added a eventListener to handle the click.
innerHTML is what you wanted i guess.
And thanks for loving me btw.
and this is a clean version of coding something like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Static Template</title>
</head>
<body>
<button id="btn0">Deftige Kartoffelsuppe</button>
<div id="ausgabe"></div>
<script>
const data = [
{
name: "Deftige Kartoffelsuppe",
preis: "4,80€"
}
];
const btn = document.querySelector("#btn0");
const ausgabe = document.querySelector("#ausgabe");
btn.addEventListener("click", () => {
ausgabe.innerHTML = `${data[0].name} für nur ${data[0].preis}`;
});
</script>
</body>
</html>
Is it possible to construct the og metatags of a website such that when the website link is shared to facebook, the preview image (a gif), animates automatically?
Here & here it's talked about how Giphy accomplishes it, by essentially wrapping the gif in an swf file. But it's 2016 so is there a better (and supported) way to accomplish this? I couldn't find anything in the facebook docs and I'd like to keep my og:type meta tag as having a value of website.
Here's a snippet of my metatag config obejct (I use React Helmet to populate the tags):
{ property: 'fb:app_id', content: 'some_app_id' },
{ property: 'og:description', content: 'My site's description' },
{ property: 'og:image', content: 'http://example.com' },
{ property: 'og:image:type', content: 'image/gif' },
{ property: 'og:title', content: 'My Site' },
{ property: 'og:url', content: 'http://example.com' },
{ property: 'og:type', content: 'website' },
{ property: 'og:image:width', content: '657' },
{ property: 'og:image:height', content: '411' },
{ charset: 'utf-8' },
{ property: 'og:site_name', content: 'My Site' },
{ property: 'og:locale', content: 'en_US' },
I looked into this last summer. My understanding was you must wrap your image in a SWF file or a javascript video player (which is really just a javascript program as far as I could tell). Many of the big players (check out any youtube page) will have a number of ways they present their content using OG - including SWF, javascript player, just as an image, etc so that as the device they are being viewed on might not have the ability to use one or more of the methods, it can fall back on another method - i.e. degrade gracefully.
Here is a youtube header (a bit overkill?):
<meta property="og:site_name" content="YouTube">
<meta property="og:url" content="https://www.youtube.com/watch?v=UKOpnK5fC4k">
<meta property="og:title" content="Pearl Jam 10-16-2014 Detroit Mi Full Show Multicam SBD Blu-Ray">
<meta property="og:image" content="https://i.ytimg.com/vi/UKOpnK5fC4k/maxresdefault.jpg">
<meta property="og:description" content="Pearl Jam 10-16-2014 Detroit Michigan Full Show Multicam SBD Blu Ray 2014 Lightning Bolt Tour Full Show Blu Ray Torrent (Added 06-05-2015) Option 1 - http://...">
<meta property="al:ios:app_store_id" content="544007664">
<meta property="al:ios:app_name" content="YouTube">
<meta property="al:ios:url" content="vnd.youtube://www.youtube.com/watch?v=UKOpnK5fC4k&feature=applinks">
<meta property="al:android:url" content="vnd.youtube://www.youtube.com/watch?v=UKOpnK5fC4k&feature=applinks">
<meta property="al:android:app_name" content="YouTube">
<meta property="al:android:package" content="com.google.android.youtube">
<meta property="al:web:url" content="https://www.youtube.com/watch?v=UKOpnK5fC4k&feature=applinks">
<meta property="og:type" content="video">
<meta property="og:video:url" content="https://www.youtube.com/embed/UKOpnK5fC4k">
<meta property="og:video:secure_url" content="https://www.youtube.com/embed/UKOpnK5fC4k">
<meta property="og:video:type" content="text/html">
<meta property="og:video:width" content="1280">
<meta property="og:video:height" content="720">
<meta property="og:video:url" content="http://www.youtube.com/v/UKOpnK5fC4k?version=3&autohide=1">
<meta property="og:video:secure_url" content="https://www.youtube.com/v/UKOpnK5fC4k?version=3&autohide=1">
<meta property="og:video:type" content="application/x-shockwave-flash">
<meta property="og:video:width" content="1280">
<meta property="og:video:height" content="720">
<meta property="og:video:tag" content="Pearl Jam (Musical Group)">
<meta property="og:video:tag" content="Pearl Jam">
<meta property="og:video:tag" content="PJ">
<meta property="og:video:tag" content="Full Show">
<meta property="og:video:tag" content="Full Concert">
<meta property="og:video:tag" content="HD">
<meta property="og:video:tag" content="Blu Ray">
<meta property="og:video:tag" content="Live">
<meta property="og:video:tag" content="Eddie Vedder (Musical Artist)">
<meta property="og:video:tag" content="Black">
<meta property="og:video:tag" content="Alive">
<meta property="og:video:tag" content="Even Flow">
<meta property="og:video:tag" content="Sirens">
<meta property="og:video:tag" content="Complete Concert">
<meta property="og:video:tag" content="Frozen Let It Go">
<meta property="og:video:tag" content="Pearl Jam Concert">
<meta property="og:video:tag" content="Pearl Jam Full Show">
<meta property="og:video:tag" content="Pearl Jam Full Concert">
<meta property="og:video:tag" content="Pearl Jam 2014">
<meta property="og:video:tag" content="Pearl Jam 10-16-2014">
<meta property="og:video:tag" content="Pearl Jam 16-10-2014">
<meta property="og:video:tag" content="10-16-2014">
<meta property="og:video:tag" content="16-10-2014">
<meta property="og:video:tag" content="Pearl Jam Detroit Full Show">
<meta property="og:video:tag" content="Pearl Jam Detroit 2014">
<meta property="og:video:tag" content="10-16-2014 Detoit">
<meta property="og:video:tag" content="Pearl Jam Joe Louis Arena">
<meta property="og:video:tag" content="Pearl Jam Michigan">
<meta property="og:video:tag" content="PJ Detroit">
<meta property="og:video:tag" content="Joe Louis Arena">