how to include small image with google share button - javascript

<li></li>
How could I add a message and a small image to share with the above (URL that currently does).

There are a couple of ways to accomplish what you're trying to do.
Option 1: Microdata
This would be the best way in my opinion, but it may take a bit of getting used to. Microdata is very powerful and there are many implementations for different types of data. The standard can be found on schema.org.
Google has a nice tool for testing Microdata, it's called the Structured Data Testing Tool.
Option 2: Open Graph Protocol
This is a bit easier to implement as it's simply just adding meta tags that are named following the protocol listed on their website.
Example:
<meta property="og:title" content="Your title about post" />
<meta property="og:url" content="http://www.website.com/coolwebsite/" />
<meta property="og:image" content="http://www.website.com/images/g_co.jpg" />

Related

Adding a link to external website and it's synopsis in my HTML

In facebook, when I add a link to a website, it automatically brings some synopsis (text and images) from the external website and adds it to the page...
Something like this:
How can this be done? I simply don't know where to start and what to google to find a tutorial about this.
What you're looking for are Open Graph Meta Tags. By including these in the <head> of your page, Facebook can then use this information to generate useful previews.
To turn your web pages into graph objects, you need to add basic metadata to your page. We've based the initial version of the protocol on RDFa which means that you'll place additional <meta> tags in the <head> of your web page. The four required properties for every page are:
og:title - The title of your object as it should appear within the graph, e.g., "The Rock".
og:type - The type of your object, e.g., "video.movie". Depending on the type you specify, other properties may also be required.
og:image - An image URL which should represent your object within the graph.
og:url - The canonical URL of your object that will be used as its permanent ID in the graph, e.g., "http://www.imdb.com/title/tt0117500/".
As an example, the following is the Open Graph protocol markup for The Rock on IMDB:
<html prefix="og: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
...
</head>
....
</html>
The excerpt above, as well as additional properties and information, can be found here: The Open Graph protocol.

share on facebook with query string

I have the following problem I can't find a proper solution for and would be very graceful for any advice.
On my website, I provide a sharing option for facebook:
Jetzt teilen
I use open graph to add meta information for the FB crawler
<meta property="og:url" content="http://www.mypage.de" />
<meta property="og:type" content="website" />
<meta property='og:title' content='MyPage'>
<meta property='og:description' content='Viele tolle Sachen'>
<meta property='og:image' content='http://www.mypage.de/image.jpg'>
This works fine so far. The user will see Image, description and Titel.
But as I want to add individual information on each shared link, I need to add a query string that is shared ( ?queryString=qwe123 ). So I change the URL:
Jetzt teilen
But when the user now clicks the link, he wont see the description and image of the page any more (the linking works fine anyway). I cant let FB crawl every possible query-string because each user has an individual one.
Anyone has a good idea?
P.S. I know that share.php is deprecated, but don't know whats the actual way to share without using an App_ID from FB.
P.P.S. I use angular 1.4 if that is of any importance

How to add the image label in Reddit share?

Hi All I integrated the Reddit sharing in my project.
While going to the Reddit share page image share option shown below is not coming.
I need that option along with other existing option as shown below.
Can anyone give an idea how can I fix this one.
You need to fill out meta tags, compatible with Open Graph Protocol. Read more on their website: http://ogp.me/
Sample code:
<meta property="og:image" content="URL" />
<meta property="og:image:type" content="image/jpeg" />

How to generate thumbnail images of HTML pages

I am trying to create thumbnail images for several HTML pages, so the user can have an idea of what the HTML looks like before they open the link. I have searched online but haven't found anything useful.
Could anyone here provide some tips? Thanks so much!
I specifically want this to happen on the server side so the client is not required to load the page
You might want to check out this url: http://html2canvas.hertzen.com/.
Using this script, you can convert the page into a canvas on the client side.
Then you can use that as your thumbnail.
You have to use Open Graph tags in you header tag:
<html>
<head>
<meta property="og:site_name" content="Your Website Name Here" />
<meta
property="og:title"
content="Yourtitle goes here, about 90 characters in length."
/>
<meta
property="og:description"
content="description of URL that is about 300 characters in length."
/>
<meta property="og:image" content="YOURIMAGEURL.JPG" />
<meta property="og:type" content="blog" />
<meta property="og:url" content="http://yourURL.com/" />
</head>
<body></body>
</html>
http://api.s-shot.ru/?=(your url)
and
https://s.wordpress.com/mshots/v1/(your url)
I hope those Help!
http://phantomJs.org offers a free tool to capture HTML locally from a file (if you enable that via a command line parameter and use the file:// URI scheme) or from a website and render it to an image. That is a very well-established very popular tool It's also used by people who write automated tests. There's a wiki page that covers that tool, and similar ones.
It has a cropping option. You could run the output of that through other image manipulation tools to scale it.
As far as getting intelligent previews/thumbnails like Twitter and Facebook do, that I'm not sure of. I know there is an oEmbed protocol that is popular that Twitter and other sites provide, and ways to extract the metadata whereby you could possibly construct your own small HTML file and then render it to an image.
(Note about phantomJs: If you don't get the image quality you want in the rendered image, try raising the quality setting for the image parameter to 100, as well as increasing the page's zoom factor option. I've found zoom factor of 2 produces profoundly better quality than zoom factor 1 - see the API docs regarding zoom).
I couldn't get phantomjs to work for my site for some reason, and in further searching I stumbled on this technique for using an iframe to simulate a thumbnail. Posting this here in case others find it useful.

How do you change what a like/send button posts to a facebook wall?

I'm working on a not for profit website, and trying to integrate with facebook. The app seems to work fine, single sign on works fine, even a custom "post to wall" function works fine using the javascript sdk. What does not work, however, is adding a photo to represent the entity, and anything other than default text, when a person clicks on the like button.
What's worse is there is some ghost text that I personally have never actually seen (other than in the text box itself) that finds its way into the dialog box when posting and leaving the text box empty.
The documentation here falls short:
https://developers.facebook.com/docs/reference/plugins/like/
Open Graph API tags also did nothing.
If you "like" the "like button" you'll see that their example does exactly what I'm trying to accomplish. There's a photo and a little description of what the button is. Is it possible to do this on other sites?
I've struggled a lot with this myself, but I found that by putting my page's URL into Facebook's debugger, it made the correct image, text, etc. show up when clicking a share button.
Add these tags in your pages' tags.
<html xmlns:og="http://ogp.me/ns#">
<head>
<meta property="og:title" content="insert your title here"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.example.com/foo/"/>
<meta property="og:image" content="http://www.example.com/images/example.jpg"/>
<meta property="og:site_name" content="A human-readable name for your site">
<meta property="og:description" content="A one to two sentence description of your page">
</head>
</html>
To turn your web pages into graph objects, you'll need to add Open Graph protocol tags and the Like button to your webpages.
Instructions are here:
http://developers.facebook.com/docs/opengraph/

Categories

Resources