Laravel – social media share buttons with custom content

facebookgoogle-pluslaravelshare-button

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:

<a href="http://www.facebook.com/sharer.php?u=http://www.mywebsite.com" target="_blank"></a>

<!-- Google+ -->
<a href="https://plus.google.com/share?url=http://www.mywebsite.com" target="_blank"></a>

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.

Best Solution

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>
Related Question