How can I customize the content display when I share a page on facebook or google plus. title, description, image..etc.. When I share my page now on facebook, it adds a certain image and title other the required. In case of google plus, image is shared correctly but still the title is not the one I need.
Here's how I currently use them:
<!-- Google+ -->
Any idea how can I customize it to my need or if there is any packages that could support me as well. Also, do I need to create an app on facebook or google plus in order to do so. I'm just using share button.
something like this for facebook share
<meta property="og:title" content="title here" />
<meta property="og:image" content="image url here" />
<meta property="og:type" content="website" />
debug your page first on facebook using https://developers.facebook.com/tools/debug/
to clear facebook cache on your site
you don't have to create app on facebook to use share button, i think it's same with gplus but i'm not sure.
or create this page as a target url to share
<php
$title = 'title';
$image = 'image';
?>
<meta property="og:title" content="{{$title}}" />
<meta property="og:image" content="{{$image}}" />
<meta property="og:type" content="website" />
<script>
window.location = "http://www.url-to-real-shared-page";
</script>
Lets say this is the content of your master.blade.php template
<!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">
#yield('og')
<title>Manny Isles</title>
Then this is your show.blade.ph template that extends the master.blade.php
#extends('layouts.master')
#section('content')
{{ $blog->content }}
#endsection
#section('og')
<meta property="og:title" content="{{ $blog->title }}" />
<meta property="og:image" content="{{ $blog->image_url }}" />
<meta property="og:type" content="website" />
#endsection
Just notice the #yield('og') and #section('og')
Related
i watch 1 youtube https://www.youtube.com/watch?v=KnsanTdY2Lc and i coding follow them but when i post a link on facebook it not show the photo why? here my code where is wrong point i can't event debug it
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="https://www.facebook.com/2008/fbml">
<meta property="og:url" content="https://3.bp.blogspot.com/-HJiRD8AiC4k/V_8MznQ6d7I/AAAAAAAADOg/yR2fUN0ja3gPltQ5S_e0NlGZ9gYRzcyyQCLcB/s1600/download.jpg" />
<meta name="googlebot" content="noarchive" />
<meta content="noindex, nofollow" name="robots" />
<meta name="medium" content="image" />
<meta property="og:type" content="website" />
<title>Berani yer....akik ni.........-(video inside)</title>
<meta http-equiv="refresh" content="0; URL=uuuuuuuuuuu" />
Try this ;)
Check your url here(URL debugger) to make sure you are providing info as expected by Facebook. Like to share image you need to add og:image property with meta tag.
Why are you adding following meta?
<meta http-equiv="refresh" content="0; URL=uuuuuuuuuuu" />
This will redirect from current url to uuuuuuuuuuu
I'm trying to use Facebook Open Graph meta tags for my site. I want my links to be showed correctly when I share them in Facebook. But it doesn't. When I test the link in Facebook Debuger but it always shows Error parsing input URL, no data was cached, or no data was scraped.. I searched a lot and read the Facebook's documentation about good examples and followed them. But no success. Here is my Page Code:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
<meta charset="utf-8" />
<title>تست</title>
<link rel="canonical" href="www.kaladaran.com">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="Product">
<meta name="description" content="Product">
<!--FACEBOOK-->
<meta property="og:type" content="website">
<meta property="og:title" content="Test">
<meta property="og:site_name" content="Kaladaran">
<meta property="og:url" content="www.kaladaran.com/test.html">
<meta property="og:description" content="Descritption">
<meta property="fb:app_id" content="My App Id">
<meta property="og:image" content="http://kaladaran.com/Data/1598/6ccec951-f124-43f6-abb0-a59e3d94bd67.jpg">
<meta property="og:image:width" content="250px">
<meta property="og:image:height" content="169px">
<meta property="og:locale" content="fa_IR"><meta property="article:author" content="https://www.facebook.com/KDAdsCo" />
<meta property="article:publisher" content="https://www.facebook.com/KDAdsCo" />
</head>
<body>
<div>
<h1>
Facebook Open Graph Tag Test
</h1>
<img src="http://kaladaran.com/Data/1598/6ccec951-f124-43f6-abb0- a59e3d94bd67.jpg" alt="Panasonic" />
</div>
</body>
</html>
I can't understand what is wrong with my code? Any help is appreciated in advance.
The line:
<link rel="canonical" href="www.kaladaran.com”> is causing the error. A canonical link is meant to point to the current page, not the home page.
Also, note that, the URL inside a <link> is relative if you leave out the http:// which is why you are getting the error.
Make it like :
<link rel="canonical" href="http://www.kaladaran.com/test.html">
<meta property="og:url" content="http://www.kaladaran.com/test.html">
Also, remember to type the exact same URL in the Facebook scraper.
When Facebook finds a canonical link that points to a different URL, it will treat it like a redirect .
From Facebook:
The following will be treated as a redirect by the crawler:
A HTTP redirect
A <link rel="canonical" href=".." /> tag
A <meta property="og:url" content=".." /> tag
https://en.wikipedia.org/wiki/Canonical_link_element
i have created an Open graph storie on my facebook app. I want to to integrate the code to my website...
this is the meta tags i use
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# rovespier: http://ogp.me/ns/fb/rovespier#">
<meta property="fb:app_id" content="349547121879416" />
<meta property="og:type" content="rovespier:art" />
<meta property="og:url" content="Put your own URL to the object here" />
<meta property="og:title" content="<?php $message; ?>" />
<meta property="og:image" content="http://www.rovespier.com/uploads/videos/images/142367443594.jpg" />
<meta charset="utf-8">
i used facebook debugger. the thing is that (because i use this code for mulptiple pages) in some pages the open graph shows ok but in some shows values like 'sample video' or another image from the one i specified on the meta tag or no image at all. Any idea why is that? Sounds kind of crazy
Start adding a width and a heigt to your og:image. If there is no image width or height set, it may take another image than the one that is defiend.
<meta property="og:image:width" content="200" />
<meta property="og:image:height" content="200" />
I'd like to show a share dialog using URL Redirection as described here : https://developers.facebook.com/docs/sharing/reference/share-dialog
The example they provide is the following : https://www.facebook.com/dialog/share?app_id=145634995501895&display=popup&href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F&redirect_uri=https://developers.facebook.com/tools/explorer
I tried to achieve the same with a custom page I created (with og meta tags), here is the code :
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<meta name="description" content="Page description. No longer than 155 characters." />
<!-- Twitter Card data -->
<meta name="twitter:card" value="summary">
<!-- Open Graph data -->
<meta property="fb:app_id" content="762471050442760" />
<meta property="og:site_name" content="Facebook Developers" />
<meta property="og:title" content="Documentation for building software with Facebook - APIs, SDKs and Services" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://developers.facebook.com/docs/" />
<meta property="og:image" content="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/YQEGe6GxI_M.png" />
<meta property="og:locale" content="en_US" />
<meta property="og:description" content="Learn how to integrate with Facebook's APIs and developer tools to drive growth and engagement to your app, website or content." />
</head>
<body>
</body>
</html>
This page is stored at this location (fake location here) -> www.mysite.com/test.html
Now I try to use the following link to share : https://www.facebook.com/dialog/share?app_id=MY_APP_ID&display=popup&href=www.mysite.com/test.html&redirect_uri=www.mysite.com
But I don't get the same result as the example they provide. Instead I get some image and description from another website (not at all the one I created with og meta tags).
How can I solve that and customize my share dialog ?
Thanks
It was a cache problem. I managed to refresh this by going to https://developers.facebook.com/tools/debug/ with the following Input URL www.mysite.com/test.html
What's the trick with Open Graph tags to get Facebook to let you to choose from a list of thumbnails?
Facebook auto-chooses the first image I output in my og tags and doesn't give me the ability to choose a second (or third, etc) from the post. The "Choose a thumbnail" control is not enabled and says 1 of 1.
When I debug the page using the Facebook debugger, it successfully shows me all the images and doesn't report any errors.
As an example, here are my og tags:
<meta property="og:title" content="Page Title">
<meta property="og:description" content="Page Description">
<meta property="og:type" content="website">
<meta property="og:url" content="http://www.test.com/index.cfm">
<meta property="og:image" content="http://www.test.com/images/og-3.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image" content="http://www.test.com/images/og-4.png">
<meta property="og:image:width" content="300">
<meta property="og:image:height" content="300">
Put <img src="image.jpg" /> in your object page's <body> for each of your images.