Dynamic share buttons for different social media

Is anyone else noticing problems with Facebook share? It seems that it is not working properly. I keep getting the message Page not found when I try to make a post on Facebook. Linkedin and Twitter are working perfectly.

Hello, I followed your amazing tutorial and Iā€™m almost there. I inspired myself also from another tutorial to create social share buttons with some code.

Ii have a petitions website and each petition is a CMS item (like a blog post). So when people read the petition, they can sign it which redirects them to a new page (where they can pay). If they donā€™t want to pay, they can just click on ā€œi want to shareā€ which redirects them to a new static page.

The only thing is that I would like to create buttons that share first page (CMS item or blog post #1).

Here is the code that I currently have:

<!-- Facebook -->
<a  href="https://www.facebook.com/sharer/sharer.php?u=[your URL path/{slug variable}]" 
	class=""
  title="Share on Facebook" 
	target="_blank" 
	onclick="window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(document.URL) + '&t=' + encodeURIComponent(document.URL),'','width=600,height=800'); return false;">
Share on Facebook</a>

How do I manage to make the sharable page another page than the page the visitor is on?

Find below my read-only link of the blog post (or petition), which is the URL that needs to be shared on social media:

https://preview.webflow.com/preview/premiere-ligne-ce4919?utm_medium=preview_link&utm_source=designer&utm_content=premiere-ligne-ce4919&preview=7e9ce6cbe0c3e02ab04a9c46b11ea70f&pageId=633393e2a818896a80021b2a&itemId=6380bd792a93aa6f0f63ad3f&workflow=preview

This is the read only link for the page where the social share buttons will appear (and also the embed code):
https://preview.webflow.com/preview/premiere-ligne-ce4919?utm_medium=preview_link&utm_source=designer&utm_content=premiere-ligne-ce4919&preview=7e9ce6cbe0c3e02ab04a9c46b11ea70f&pageId=633d7573a9d6ff1ae0f6c2f3&workflow=preview

There is also another issue, when I tried to replace ā€œdocument.URLā€, it stopped opening the window in a pop up window. It opened a new tab which I donā€™t want. Would be great if that keeps the same properties too.

Thanks a lot

mod-edit: added closing to code block

Helloā€¦
I could really use some help with this! I have tried to follow the instructions over and over and I canā€™t get the share function to work. I donā€™t have a clue as to what Iā€™m doing incorrectly.
Here is a read-only link to a blog post with the social share buttons.
Here is the published staging site.

Thanks in advance to anyone kind enough to help!

UPDATE: I finally got my buttons to work. The only question I have now is: When you share via email, the title of the blog post is the subject line and the link to it is in the body of the email. Is that all? Or is there a way for it to pull content with OG settings like it does for LinkedIn and Facebook?

Buenas a todos, por favor si me pueden ayudar con una duda, por que cuando comparto en linkedin un articulo de mi pagina, no sale la previa, es decir, imagen con titulo, sino el nombre de la pagina principal, esto pasa con algunos no todos, ya otros articulos si comparte bien, estoy utilizando el codigo. Gracias de antemano.

Can u please provide this code for instagram also.

Iā€™m not sure why webflow hasnā€™t built this sharing option natively till now. but come across this simple solution that might be just what youā€™re looking for. Blog Social Media Share Buttons by Pixeto - Webflow

The solution I have involves using attributes, making it easy to implement even for those without extensive coding knowledge. If youā€™re interested, You can check it out here:

Feel free to give it a try, and let me know if you have any questions or need further assistance!