Jekyll_facebook_twitter

Hello;
Is there any way to send a post straightway from a blog jekyll to social Networks ?
Thanx

I’m assuming you mean when the post is published. And not adding a share button to the site.

Jekyll doesn’t have social integrations. Maybe plugins can help.

The challenge is figuring out the rule. When should a post get shared to social media, such that it gets shared on creation (and is not missed), and does not get shared on edits.


The simplest is just to do it manually. It doesn’t take that much effort to copy and paste a URL and give it a title and if you do even a few posts a day it still takes a small amount of time to share compared to how long it took to write the article.

If you want to take that a step further, you can add a button to the top of each of your posts using HTML in your posts layout. Then after publishing your post, you click the Tweet button and it redirects you to Twitter with a prefilled message. And anyone can click the button.

If you’re interested in this, do some research on how to make a share button for FB and Twitter. Maybe a Jekyll plugins or and _includes file for each.

Try these from Share buttons | Jekyll Codex

<div class="facebook" title="Share this on Facebook" 
 
 onclick="window.open('http://www.facebook.com/share.php?u={{ site.url }}{{ page.url }}');">
    <svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759h-306v-759h-255v-296h255v-218q0-186 104-288.5t277-102.5q147 0 228 12z"/>
    </svg>
</div>

    <div class="twitter" title="Share this on Twitter" onclick="window.open('http://twitter.com/home?status={{ site.url }}{{ page.url }}');"><svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1684 408q-67 98-162 167 1 14 1 42 0 130-38 259.5t-115.5 248.5-184.5 210.5-258 146-323 54.5q-271 0-496-145 35 4 78 4 225 0 401-138-105-2-188-64.5t-114-159.5q33 5 61 5 43 0 85-11-112-23-185.5-111.5t-73.5-205.5v-4q68 38 146 41-66-44-105-115t-39-154q0-88 44-163 121 149 294.5 238.5t371.5 99.5q-8-38-8-74 0-134 94.5-228.5t228.5-94.5q140 0 236 102 109-21 205-78-37 115-142 178 93-10 186-50z"/></svg></div>

Though the content above neglects the fact that baseurl for a GH Pages site is needed. So this is best for URL:

"{{ page.url | absolute_url }}"

Let me know if you need more help.

For interest, how to use GH Actions and Python to send a tweet.

Note that using the Twitter API is not straightforward. You have to go through an application process with a motivation for your use case and you might get rejected a few times.

Adding a share button that skips the API is way easier in comparison.

Finally, i will do as you say, manually. I am a beginner and I have no experience in Jekyll!
Thanx!!!

1 Like

This is bigger than just Jekyll. If you have an RSS feed on your site, you could use a 3rd party service like If This Then That (IFTTT) - https://ifttt.com

It will look at your RSS feed and when it finds a new post, you can configure it to do all kinds of things, like post to socials etc.

1 Like

Indeed. I was trying to think of a way and yes listening to an RSS feed would work.