How to automatically inject some text to twitter share box? - html

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

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 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).

Integrating with Twitter

I hate to be doing this, but since going through the proper channels has led to being completely ignored for two weeks, I bring myself here instead. Hopefully you guys can prove why we're better ;)
I'm trying to integrate Twitter Cards, however despite following the instructions, and despite the Validator loading just fine (screenshot of the validator), it fails to show up in actual Tweets.
The URL being Tweeted in this example is http://pfq.link/?Megayena and the relevant Meta tags on that page are:
<meta name="twitter:card" content="product" />
<meta name="twitter:site" content="#SystemSalamence" />
<meta name="twitter:creator" content="#SystemSalamence" />
<meta name="twitter:domain" content="pokefarm.com" />
<meta name="twitter:title" content="Sei's Mightyena on PokéFarm Q" />
<meta name="twitter:image" content="http://pfq.link/?Megayena=004000ccff99300300.png" />
<meta name="twitter:label1" content="Species" />
<meta name="twitter:data1" content="Mightyena [Mega Forme Q]" />
<meta name="twitter:label2" content="Held item" />
<meta name="twitter:data2" content="No item" />
<meta name="twitter:description" content="Sei's Mightyena is a Level 100 Mightyena [Mega Forme Q]. She is hungry, so come visit her on Solaria and give her a Berry!" />
Everything looks valid, and it works on the validator preview, so why are Tweets not getting their cards?
When visiting the URL and inspecting (view source in the browser) your tag refers to a different URL than the one in the question.
it currently refers to:
http://pokefarm.com/img/script/pokemon?00400ccff99300300Megayena
Trying to visit that image URL, It returned a HTML page that contains an error (PHP error).
maybe that is the problem.
Have you tried using a summary card rather than a product card?
https://dev.twitter.com/cards/types/summary
While I can't see any obvious errors in the code, it might be worth trying different cards and seeing if they work.
The problem comes perhaps from there :
The image must be a minimum size of 120px by 120px
See https://dev.twitter.com/cards/types/summary

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>