Wixideas
Apr 2, 2024
9
Tags:
Database filter, Frontend, Database, Our practice, development, Social, Coding, Dynamic page, Wix practice, Dataset, CMS, Our Practice, VELO, Web design skill
This Wix Social Share tutorial shows you how to add custom elements that allow you to share your website with top social media platforms.
There's no doubt that some of your site visitors may want to engage their friends and families with your content, and that's where social sharing comes in.
There are several benefits of having a social share button on your website, including:
Increased visibility: Social share buttons make it easy for visitors to share your content on their social media platforms. This can increase the visibility of your content and attract new visitors to your website.
Improved engagement: When visitors share your content on social media, it can lead to increased engagement with your brand. Social shares can generate likes, comments, and shares, all of which can help to build a sense of community around your brand.
Enhanced credibility: When visitors see that others are sharing your content on social media, it can enhance your credibility and authority in your industry.
Increased website traffic: Social shares can drive traffic to your website. As more people share your content on social media, it can lead to a snowball effect of increased traffic to your website.
Improved search engine ranking: Social shares can also help to improve your search engine ranking. Google takes social signals into account when determining search rankings, so having social shares can help boost your visibility on search engines.
In terms of Wix Ideas, here are some tips for adding social share buttons to your Wix website:
Customize your buttons: With Wix, you can customize your social share buttons to match your website's branding and design.
Add buttons to specific pages: Consider adding social share buttons to specific pages on your website, such as blog posts or product pages, to encourage visitors to share that content.
Monitor your results: Keep an eye on how many social shares your website is generating and which platforms are most popular. This can help you to optimize your social share button strategy over time.
Copy the code below:
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';
$w.onReady(function () {
let siteUrl = wixLocation.url;
$w("#facebookShare").link = `https://www.facebook.com/sharer.php?u=${siteUrl}`; $w("#twitterShare").link = `https://twitter.com/intent/tweet?url=${siteUrl}`;
$w("#pinterestShare").link = `http://pinterest.com/pin/create/button/?url=${siteUrl}`; $w("#linkedInShare").link = `https://www.linkedin.com/sharing/share-offsite/?url=${siteUrl}`;
//TRIGGER URL BOX
$w("#urlTrigger").onClick(() => {
$w("#urlBox").collapsed ? $w("#urlBox").expand() : $w("#urlBox").collapse(); });
//ADD URL TO BUTTON LABEL
$w("#urlButton").label = siteUrl;
//COPY TO CLIPBOARD
$w("#urlButton").onClick(() => {
wixWindow.copyToClipboard(siteUrl).then(() => {
$w("#urlButton").label = `Recipe URL copied!`
setTimeout(() => {
$w("#urlButton").label = siteUrl;
}, 1000);
})
})
});