rob-murray / jekyll-twitter-plugin Goto Github PK
View Code? Open in Web Editor NEWA Liquid tag plugin for the Jekyll blogging engine that embeds Tweets, Timelines and more from Twitter API
License: MIT License
A Liquid tag plugin for the Jekyll blogging engine that embeds Tweets, Timelines and more from Twitter API
License: MIT License
I'm using the latest version 2.1.0 but I'm having trouble getting multiple options working:
{% twitter https://twitter.com/moyix/status/1486860078477156355 dnt=true width=350 conversation=none cards=hidden %}
Produces:
<div class='jekyll-twitter-plugin'><blockquote class="twitter-tweet" data-dnt="true"><p lang="en" dir="ltr">Wow, this looks like a big step forward for Binary Ninja! Congrats to <a href="https://twitter.com/vector35?ref_src=twsrc%5Etfw">@vector35</a>, I'm looking forward to trying it out (especially the new Pseudo-C decompiler)! <a href="https://t.co/4GiBoS8NhP">https://t.co/4GiBoS8NhP</a></p>— Brendan Dolan-Gavitt (@moyix) <a href="https://twitter.com/moyix/status/1486860078477156355?ref_src=twsrc%5Etfw">January 28, 2022</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
Notice that the width, conversation, and cards options are not being passed.
If I manually replace the liquid with the HTML and add the data-conversation
, data-width
, data-cards
fields, the embed works as expected.
The previous plugin enabled you to pass extra options to Twitter API via KV pairs to customise the appearance of the content to be rendered.
{% request etc... align='right' width='350' %}
Grab everything after the N required arguments as optional params and pass to the Twitter API.
So, in the form of an Oembed request like this below would get the correctly specified content.
{% twitter oembed https://twitter.com/rubygems/status/518821243320287232 align='right' width='350' %}
This is the content of the cache file, and I don't know what to do with this error.
Thanks.
Hi,
After successful installing the plugin it seems every time i actually try and use the plugin i get the following error:
Liquid Exception: SSL_connect returned=1 errno=0 state=error: certificate verify
Any ideas why this would be the case?
I tried to use the plugin using the gemfiles and it works locally on my laptop, but if I try to build the page via GitHub, I just get an error. Can I fix it somehow?
The tag twitter
on line 1 in _posts/2017-08-09-Anti-Damone.md
is not a recognized Liquid tag. For more information, see https://help.github.com/articles/page-build-failed-unknown-tag-error/.
I was hoping hashtag search would work, such as:
{% twitter https://twitter.com/hashtag/catz limit=5 %}
However, the response provided is something like this:
There was a 'Not Found' error fetching URL: 'https://twitter.com/hashtag/catz'
I've been troubleshooting for about an hour now and I can't get the plugin to work at all. I've double-checked that my credentials are correct and that the links I'm trying to oembed are correct.
I'll update this issue if I can find anything but I wanted to see if I was the only one dead in the water on v1.2.0.
See #31
Background on this is that Jekyll was choking on the newline when a tweet was included as part of a list item, causing the list to close early and leaving a dangling
The Twitter embed comes back with \n between the blockquote and the script. For whatever reason Jekyll hated this. ¯_(ツ)_/¯
Would you consider adding support for this strategy in this plugin?
https://github.com/KyleMit/eleventy-plugin-embed-tweet
There are distinct advantages to this strategy, both in terms of performance and privacy.
I might try to work on a PR if this would be considered for this plugin.
On the rendered page, nothing but the link to the twitter page shows. No twitter feed embedded. Could I have misinstalled or have a setting wrong? I believe I had this working at some point.
This is what I get when I put {% twitter https://twitter.com/username maxwidth=500 limit=5 %}
in my .html and after I've run jekyll serve
:
<div class="jekyll-twitter-plugin">
<a class="twitter-timeline" data-width="500" data-tweet-limit="5" href="https://twitter.com/username?ref_src=values">Tweets by Username</a>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
</div>
It seems that tweets are always fetched. From my debugging and limited Ruby experience, the problem is the following:
An Oembed
instance gets created. It's key
is <url>-
(note the empty right part). After the tweet is fetched, that key becomes <url>-{id: <id>}
. So when we check on the cache, we use one hash, but when we store, the hash changes.
I'm not sure how @params
gets modified (unless when calling @client.oembed tweet, @params
that modifies them, of course).
At least for my use case, making the key just <url>
works, but having the @params
as part of the key might have some implications I'm not fully aware of.
It seems with the (new ?) publish platform that we do not need to use the Twitter gem, we can take the status, timeline, list or search url and pass straight to this api.
Pros:
Cons:
For my current site, I use Jekyll Assets and Webmentions and they provide the changing of the cache directory. It's handy when doing things like buildpack-based deployment on Heroku or using Docker and intermediary builds.
Having something like twitter_cache: .cache/twitter
would be great.
Hello,
I'm trying to use variable (for my example: page.tweet) without luck. What I tried:
method 1
{% include tweet.html
tweet = page.tweet
%}
tweet.html:
{% twitter include.tweet align='center' %}
method 2
{% twitter page.tweet align='center' %}
Thank you
It would be nice if the Twitter details could be set in _config.yml. I can do a pull request on this sometime if that's optimal.
If you manually set <blockquote class="twitter-tweet" data-cards="hidden">
it will hide data cards. Is there any way to pass that into the {% twitter %}
tag?
If I try to edit the cached version to include that, then it just writes out a new cache file and ignores the modified version.
Using additional parameters does not change the cache key so the same cache content is always used regardless of parameters.
Therefore only possible to display a Tweet with new options by deleting the cache.
The cache key currently just takes the Tweet specific elements of the status url and not additional params - fix this to build a key from the param hash too.
The Twitter API seems to be returning a few Http 403's with "Sorry, you are not authorized to see this status.". These are raised as Twitter::Error::Forbidden
via the Twitter gem.
This could be due so some Twitter API changes or Twitter user changes? Think if the Dev account used via the API does not follow the Tweet poster, and they mark their Tweets as private then the request fails.
Just got an email from Github with the following message:
The tag `twitter` in `_posts/xxxx-xxxx-xxxxx/#excerpt` is not a recognized Liquid tag.
Bummer.
I installed this plugin using the ruby gem as instructed. I can't get it to work. Every time I've tried, I get the following message:
Liquid Exception: Failed to open TCP connection to : (getaddrinfo: nodename nor servname provided, or not known) in //path/to/file/_posts/2022-04-26-April26.md
I thought I would try and run the tests as described. When I run the test I get the following output
$ ruby spec/integration_tests.rb [7:32:32]
<internal:/usr/local/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- byebug (LoadError)
from <internal:/usr/local/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from spec/integration_tests.rb:8:in `<main>'
I don't know ruby very well so I'm not sure what is happening here. Please advise
I don't know if this is even possible. but I am looking for a solution where I would like to embed all my tweets with a specific tag to be embedded in my jekyll site.
For ex: I would like to have a Tweets page where I would want all my tweets with tag #TIL to be embedded in a list or grid.
I am not sure if this is possible or very difficult. Please close this issue if not possible.
Thanks.
I am using the Manual process to implement twitter
I have followed the following steps
$ mkdir -p _plugins && cd _plugins
$ wget https://raw.githubusercontent.com/rob-murray/jekyll-twitter-plugin/master/lib/jekyll-twitter-plugin.rb
And I also added
plugins: ['jekyll-twitter-plugin'] ---> this in _config.yml
I also added the following piece of code in my index.html
{% twitter https://twitter.com/jekyllrb maxwidth=500 limit=5 %}
But nothing seems to be work on my local machine
Reproducible with a sample page:
---
title: Example
---
{% twitter https://twitter.com/DegenRolf/status/1286929770488487936 %}
aaa
{% twitter https://twitter.com/DegenRolf/status/806044913854976000 %}
And outputted HTML:
<div class="jekyll-twitter-plugin">
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">Just saying “have a nice day” to a stranger helped people have a nicer day themselves. <a href="https://t.co/qt01mlakJB">https://t.co/qt01mlakJB</a> <a hr
<p>— Rolf Degen (@DegenRolf) <a href="https://twitter.com/DegenRolf/status/1286929770488487936?ref_src=twsrc%5Etfw">July 25, 2020</a></blockquote>
<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div></p>
<p>aaa</p>
<div class="jekyll-twitter-plugin">
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">Gift-givers are often too much focussed on the moment of the gift handover to achieve the optimal impact. <a href="https://t.co/a3OTE1Nm9c">https://t.
<p>— Rolf Degen (@DegenRolf) <a href="https://twitter.com/DegenRolf/status/806044913854976000?ref_src=twsrc%5Etfw">December 6, 2016</a></blockquote>
<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div></p>
</blockquote>
</div>
</blockquote>
</div>
This plugin was intended to be able to use any of the Twitter API functions, so the tag arguments are as follows.
{% plugin_type api_type *params %}
At the moment the need has not arisen for more api types so maybe make the current oembed
type the default so that you can just do this.
{% twitter https://twitter.com/rubygems/status/518821243320287232 %}
This means you soon rack up over API limit errors.
Hi Rob,
I searched for an easy way to embed Tweets into my Octopress/Jekyll blog and your plugin was really easy to install and set up.
Only problem I have is a line of HTML after each embedded tweet reading:
<script async src=”//platform.twitter.com/widgets.js” charset=”utf-8”>
The copy & pasted HTML from Safaris Source view is:
<div class="embed twitter"><blockquote class="twitter-tweet"><p>jekyll-twitter-plugin (1.0.0): A Liquid tag plugin for Jekyll that renders Tweets from Twitter API <a href="http://t.co/m4EIQPM9h4">http://t.co/m4EIQPM9h4</a></p>— RubyGems (@rubygems) <a href="https://twitter.com/rubygems/status/518821243320287232">October 5, 2014</a></blockquote>
<script async src=”//platform.twitter.com/widgets.js” charset=”utf-8”></div>
Here is a screenshot of the problem:
I am running OS X 10.10 and Ruby 1.9.3 via rbenv.
Is there some way to get rid of this last line? Did you see something like this before?
Regards
Dennis
Hi,
I'm using the {% twitter ... %}
tag and it correctly writes out a hashed file for a Tweet in the .tweet-cache
folder but I don't think this file ever gets read.
If I edit the cached file to modify a tweet it still pulls the original. This holds true even if I completely shut down and rebuild the site with Jekyll. I even went as far as modifying the render
method to only return the cached_response
but it seems to still pull the live_response
.
Even better than #12, it would be nice if we could set the plugin to find tweet URLs in Markdown files without any specific syntax.
Inspired by https://github.com/takuti/jekyll-lazy-tweet-embedding/blob/master/lazy_tweet_embedding.rb
I'm having trouble getting this running. Here are the steps I've taken so far:
gem 'jekyll-twitter-plugin'
and gem 'twitter'
to my Gemfile
gems: ['jekyll-twitter-plugin', 'twitter']
to _config.yml
echo $TWITTER_<name>
for each variablebundle update
But I always get the following result:
$ rake generate## Generating Site with Jekyll
identical source/stylesheets/screen.css
Configuration file: /Users/jeremykendall/dev/blog/jeremykendall.net/_config.yml
Source: source
Destination: public
Generating...
Liquid Exception: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed in _posts/2013-11-24-php-and-capistrano-3-notes-to-self.markdown/#excerpt
jekyll 2.4.0 | Error: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
What am I missing?
Hi,
I am in the process of implementing a cookie consent dialog for the al-folio template (alshedivat/al-folio#199). It should allow users to individually opt-in / opt-out of using cookies. This means I need to disable / enable the twitter post when the website is displayed in the browser. It is not enough to hide the <div>
the plugin is using for the twitter post. I need to prevent the actual API calls from happening, so no cookies are set by twitter.
Is this possible? And how would I achieve this?
If you would also show comments of a tweet one could use it as a kind of comment via twitter function on a blog
Hello,
I added manually this plugin to my jekyll blog, but when commited to github I get an error:
The tag
twitteron line 5 in
_posts/xxx.md is not a recognized Liquid tag. For more information, see https://help.github.com/articles/page-build-failed-unknown-tag-error/.
I thought as this is a liquid plugin it would work, but it doesn't. What am I missing here?
Thank you in advance,
Alex
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.