Hi I used this code to get share the page I’m on to social media platforms. The pages are dynamic pages and the socia media links work but I’m having trouble with Facebook pulling the content from the page I’m on. It pulls the image and the words “Title and or Description”, depending on the page im sharing. It doesn’t actually pull the content from the articles.
Can anyone help me?
I even selected the title and image to be displayed in the SEO setting on the dynamic wix pages. This is a photo if what I see when I manually try to share the post and also when I use the share button in the browser.
Appreciate any help.
Link for reference https://www.resetyourworld.org/house-and-home/9-household-items-you-should-dispose-of-every-few-months-or-years
This is the code that I used.
import wixLocation from ‘wix-location’;
import wixCRM from ‘wix-crm’;
let picture;
let url;
let filename;
let link;
$w.onReady(function () {
link = wixLocation.url;
let item = $w(‘#dynamicDataset’).getCurrentItem();
picture = item.image;
url = picture.split(“/”)[3];
filename = item.title;
$w("#pinterestShare").link = `https://www.pinterest.com/pin/create/button/?url=${link}&media=https%3A%2F%2Fstatic.wixstatic.com/media/${url}?&description=${filename}&display=popup`;
$w("#twitterShare").link = `https://twitter.com/share?url=${link}&display=popup`;
$w("#facebookShare").link = `https://www.facebook.com/sharer/sharer.php?u=${link}&display=popup`;
$w("#mailShare").link = `mailto:?subject=${link}`;
$w("#linkedShare").link = `https://www.linkedin.com/shareArticle?mini=true&url=${link}&display=popup`;
export function pinterestShare_click(event) {
$w(“#pinterestShare”).target = “_blank”;
}
export function twitterShare_click(event) {
$w(“#twitterShare”).target = “_blank”;
}
export function facebookShare_click(event) {
$w(“#facebookShare”).target = “_blank”;
}
export function mailShare_click(event) {
$w(“#mailShare”).target = “_blank”;
}
export function linkedShare_click(event) {
$w(“#linkedShare”).target = “_blank”;
}