Displaying the image of choice via shared links eg Facebook like? - html

If I share the link to my page via Facebook the wrong image appears. How can I control which image is displayed when my page is shared in social media such as facebook and previewed:
The image of the envelope displayed above is what I'd like to control.
Thank you

try put this code in tag head of page that you want to share, it work in my web:
<head>
<meta name="title" content="title" />
<meta name="description" content="description" />
<!-- deafult image for fb share -->
<link rel="image_src" href="http://web.com/myweb.png" />
</head>

Related

How do I assign an image to external links?

Bit of a silly question but when I'm linking my portfolio to external sites like Linkedin, a randomly selected image shows up. How do I change the source for my image so that I can use my logo as the image shown instead?
You can just include your logo as a source to the image in your source code:
<img src="url-to-your-logo" alt="alternative text">
What you need to do is add a reference to the image you want to display in a meta tag with a property="og:image" attribute.
Such meta tags control which information will be displayed when sharing your link:
<meta property="og:title" content="Title Of My Site">
<meta property="og:description" content="This description will appear below the title in a smaller font.">
<meta property="og:image" content="http://mysite.example.com/show-this-instead-of-linkedin-logo.jpg">
<meta property="og:url" content="http://mysite.example.com">
You can check this CSS Tricks article for more information.

How to automatically inject some text to twitter share box?

I've added meta tags to show summary_large_image box for twitter share. Once the twitter share window pops up, it looks like this:
Once I clicked Tweet, the summary_large_image can be displayed correctly with no problem. Here is the meta code:
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:description" content="patch-package is like a bandage. It saved my life!!!" />
<meta name="twitter:image" content="https://image.mux.com/d4OkE5whZfyg1VJogOTf8AAHcMG00ak24h6JQYWNo/thumbnail.png?width=700&height=400" />
<meta name="twitter:site" content="#lonelydotdev" />
<meta name="twitter:title" content="react-video-recorder works in firefox now!!!" />
But what I really want to see in the share window is something like following, where it not only has the url link, but has some text description, as well as via #username in the end:
How can I automatically inject the description and site owner to the share textarea? Thanks!
I am using react-share npm package. It has via, related, title such parameters that I can use to inject those text.
https://www.npmjs.com/package/react-share

How to implement social sharing in angular6?

Like normal web applications I want to implement social sharing by providing share button for this I have defined the meta tag in my current html component but It's not showing the image. I think in angular there is some different way of implementing social sharing.
share.component.html
<meta name="twitter:card" content="summary"/> <!-- Card type -->
<meta name="twitter:site" content="Pratyashi"/>
<meta name="twitter:title" content="Pratyashi From Title">
<meta name="twitter:description" content="Description" />
<meta name="twitter:creator" content="Creater"/>
<meta name="twitter:type" content="image"/>
<meta name="twitter:image:src" content="https://www.gstatic.com/webp/gallery3/1_webp_a.png" />
<meta name="twitter:domain" content="http://vmandi.com" />
tWITTER
This code just displays a text : Twitter which takes to a link. If you want image associated with it, just add an <img> tag. And kindly explain what you actually want to do. meta tag is mainly for SEO purpose.
More about meta tags: https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/The_head_metadata_in_HTML
Hope it helps: Angular6 Social Share Demo

HTML | Description in Facebook not Changing

When I shared a link on the Facebook, Facebook only show the last or previous of my Website.
New title: Kirk Niverba | Official Website
Old Title: W3Schools Web Development
Picture Titles | Facebook
Note that in the "New Title" is scriptly edited on Facebook (Inspect Element edit)
Thanks for someone will notice this =)
I think i understand. In order for you to do this, look specifically at this link
https://developers.facebook.com/docs/plugins/like-button
Which gives you some ideas about how to specify the content shown on Facebook once someone shares your web page, on their FB page.
Also for some added reference, check this links as well.
https://developers.facebook.com/docs/sharing/web
It will give you what you need.
EDIT*** specifically, when you add it properly, these lines will give you exactly what you need alongside an image for your post/share.
<head>
<title>Your Website Title</title>
<!-- You can use open graph tags to customize link previews.
Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
<meta property="og:url" content="http://www.your-domain.com/your-page.html" />
<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.your-domain.com/path/image.jpg" />
</head>
Otherwise, FB uses old/current page data at random i believe. Or based on a percentage of the top 1/3 of the page(if i remember correctly).

How to exclude images from the facebook like button

I'm having a problem with my facebook like button and the webpage. The webpage contains banners and random images as well as the article image, now facebook have removed the share button, though it still works, but with the current like button. Facebook chooses the image automatically, and sometimes it chooses the banners instead of the article image. Is there any alternate way instead of adding properties to the article images? Like exculding all the images but the article image.
This answer isn't necessarily helpful for "excluding" specific images, but you can control what Facebook scrapes off of your page via Open Graph protocol with meta tags. For example:
<meta property="og:title" content="This is my title" />
<meta property="og:type" content="activity" />
<meta property="og:url" content="http://www.mysite.com/redirect/" />
<meta property="og:image" content="http://www.mysite.com/logo.jpg" />
<meta property="og:site_name" content="I'm on Facebook!" />
<meta property="og:description" content="Hello World!" />
This will force Facebook to reference http://www.mysite.com/logo.jpg to use as thumbnail.
Additionally, my blog post on the related subject matter might help you: http://weblogs.asp.net/kon/archive/2011/06/07/trick-facebook-scrapping-of-facebook-tab-url.aspx
I had the same problem. Kon has a good suggestion, but I'd rather have Facebook use the article image and not the logo, so what I did is put all logos and ad banners as background-image through CSS.
Something like this:
<span style="background-image: url('IMAGE OF AD'); width:Xpx; height:Xpx; display:block;"></span>