Webflow sync, pageviews & more.
NEW

How can I embed social sharing buttons with dynamic links from Webflow CMS to ensure that only the current CMS page is shared and not the entire site?

TL;DR
  • Use CMS fields like Slug and Title to build dynamic social share URLs for each Collection Page.
  • Add Buttons or Link Blocks with External URLs that concatenate your domain and CMS data for Facebook, Twitter, and LinkedIn sharing.
  • Optionally, open links in new tabs using custom attributes or use JavaScript embeds for dynamic full URLs if needed.

To embed social sharing buttons that dynamically share the current CMS page URL, you need to use Webflow CMS fields and dynamically generate the share links.

1. Use Webflow CMS Slugs for URLs

  • In a Webflow CMS Collection Page (like a blog post template), each page has a unique slug.
  • You can use the Current Page URL by combining your domain with the dynamic slug using a Text Link or Button.

2. Build Dynamic Social Share URLs

Create dynamic share links using CMS fields:

  • Facebook: https://www.facebook.com/sharer/sharer.php?u=yourdomain.com/blog/[slug]
  • Twitter: https://twitter.com/intent/tweet?url=yourdomain.com/blog/[slug]&text=[post title]
  • LinkedIn: https://www.linkedin.com/sharing/share-offsite/?url=yourdomain.com/blog/[slug]

To implement:

  • Add a Button or Link Block inside your CMS Collection Page.
  • Set the link type to External URL.
  • Click the "+" icon next to the URL field, then insert the current CMS field such as Slug or Title (e.g., https://yourdomain.com/blog/ + slug field).
  • For Twitter, you can also insert the name of the blog post into the text= parameter.

3. Use Webflow’s Custom Attributes (Optional for Advanced Use)

If you want to open share links in new windows:

  • Select the link element.
  • Add a custom attribute:
  • Attribute name: target, Value: _blank

4. Handle Full URLs Automatically

If you want fully dynamic URLs that include your domain without hardcoding:

  • Use Webflow’s Current URL workaround by placing a custom embed with JavaScript to pull window.location.href, but this only works on the live site and is not part of CMS data editing.

Embed example:

  • Add a custom embed block, then use an anchor with JavaScript grabbing window.location.href to populate share links dynamically.
  • Avoid this if you prefer a no-code method; it's harder to manage and test within the Designer.

Summary

To share only the current CMS page, build dynamic share URLs using CMS fields like Slug and Title. Use External URL links in your CMS Template and concatenate CMS data to create platform-specific links for Facebook, Twitter, and LinkedIn.

Rate this answer

Other Webflow Questions