Social network link

Hi I have added the following link to my site
let picture;
let url;
let filename;
let link;
$w.onReady( function () {
link = wixLocation.url;
let item = $w(‘#dynamicDataset’).getCurrentItem();
picture = item.photo;
url = picture.split(“/”)[3];
filename = item.memoryEventDescription;
$w(“#twitterShare”).link = https:twitter.com/share?url=${link}&display=popup;

export function twitterShare_click(event) {
$w(“#twitterShare”).target = “_blank”;
}

and I get this error preview however when i test i published mode nothing happens at all

Wix code SDK error: The link property that is passed to the link method cannot be set to the value “https:twitter.com/share?url=https://adcatch02.wixsite.com/folloapp/view/fullname/Adam-Roger-Catchpole/6f119cf5-9f86-4106-a2ce-85293b9cb21d?dsOrigin=Editor1.4&editorSessionId=91b5b3da-51b1-46ea-8960-34da93e4d6c0&esi=91b5b3da-51b1-46ea-8960-34da93e4d6c0&isEdited=true&isSantaEditor=true&lang=en&metaSiteId=594d236f-b270-48eb-bf5b-6399d04830fd&display=popup” as this is not a supported link type.

You might be interested in looking at @code-queen tutorial from a couple of years ago now about adding social links as you will be able to see how to use the Twitter share link in her example.

Example Page - https://codequeen.wixsite.com/social-sharing
Tutorial - https://support.totallycodable.com/en/article/create-custom-share-buttons-for-social-media-platforms
YouTube Video - Customize share buttons on wix - Pinterest Facebook Dynamic Email

Thanks GOS this is where i took her code from. Unfortunately I cannot get anywhere with a response from any support channels associated with Code Queen’s network. I’m sure i’ve followed the tutorial word for word, hence do not get the SDK error

I have the import APIs at the top my page so i really don’t know how to fix this ?

There are 2 bugs in your code.

  1. You have not closed the onReady() function
  2. You are writing a wrong URL format (missing // after https:)
let picture;
let url;
let filename;
let link;

$w.onReady(function () {
   link = wixLocation.url;
   let item = $w('#dynamicDataset').getCurrentItem();
   picture = item.photo;
   url = picture.split("/")[3];
   filename = item.memoryEventDescription;
   $w("#twitterShare").link = `https://twitter.com/share? 
   url=${link}&display=popup`;
});

export function twitterShare_click(event) {
   $w("#twitterShare").target = "_blank";
}

Also, kind request: Please use the code block for your code and format it. Its difficult to read code in plain text.

My published site dynamic page url does eliminate the editor additional information contained below so i think he published url should work fine

?dsOrigin=Editor1.4&editorSessionId=91b5b3da-51b1-46ea-8960-34da93e4d6c0&esi=91b5b3da-51b1-46ea-8960-34da93e4d6c0&isEdited=true&isSantaEditor=true&lang=en&metaSiteId=594d236f-b270-48eb-bf5b-6399d04830fd

Sorry Shan,

I didn’t see your response earlier. I have attached the code block this time as also includes line numbers to help highlight errors and omissions


the other social links also have similar export functions as twitterShare but omitted to keep block concise

link 97, 98, 100, 101 should start the link like below:

`https://

On line 97 you have put the forward slashes before the colon. It should come after. Check my sample code again.

thanks such simple errors by me and now it all works. Thanks again

ok the only link that doesn’t work on my published site and tells me it will is mailto

$w(“#mailShare”).link =mailto:?subject=&bcc=adcatch02@wix.com&body=${link};