Skip to content

Commit

Permalink
Replace tweet embeds
Browse files Browse the repository at this point in the history
During the Jekyll era, we used a Ruby oEmbed library to display tweets inline.

This commit replaces tweet-embedding functionality, permanently caching all retrieved tweets.

This commit:

- Removes the unused Ruby plugin
- Removes placeholder oembed tags from filters/configuration
- Adds an 11ty Twitter embed plugin
- Adds permanent tweet caching
- Changes all posts with embedded tweets to use new syntax (just the URL)
- Incidentally removes a stray README which was getting incorrectly pulled into the asset pipeline
  • Loading branch information
beechnut committed Jun 12, 2024
1 parent d9484ad commit 82eda42
Show file tree
Hide file tree
Showing 34 changed files with 53 additions and 77 deletions.
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-0ce81ce23a2491fe0e6fe7a76d2d95
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"0ce81ce23a2491fe0e6fe7a76d2d95":"1"},{"cachedAt":1718212425058,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-0ce81ce23a2491fe0e6fe7a76d2d95.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/stroupaloop/status/593525508945489921","author_name":"Andrew Stroup 최영호","author_url":"https://twitter.com/stroupaloop","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">Some <a href=\"https://twitter.com/WhiteHouse?ref_src=twsrc%5Etfw\">@WhiteHouse</a> Pres Innov Fellows on policing data at moveForward(100) / @whitehouseostp talks <a href=\"https://twitter.com/18F?ref_src=twsrc%5Etfw\">@18F</a> <a href=\"https://twitter.com/USGSA?ref_src=twsrc%5Etfw\">@usgsa</a> <a href=\"https://twitter.com/hashtag/govlife?src=hash&amp;ref_src=twsrc%5Etfw\">#govlife</a> <a href=\"http://t.co/QTqfMmbhFs\">pic.twitter.com/QTqfMmbhFs</a></p>&mdash; Andrew Stroup 최영호 (@stroupaloop) <a href=\"https://twitter.com/stroupaloop/status/593525508945489921?ref_src=twsrc%5Etfw\">April 29, 2015</a></blockquote>\n<script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-2c6b74860b54324c210492f60eb9ea
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"2c6b74860b54324c210492f60eb9ea":"1"},{"cachedAt":1718212425287,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-2c6b74860b54324c210492f60eb9ea.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/seldo/status/571453200093437952","author_name":"Laurie Voss","author_url":"https://twitter.com/seldo","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">Does your project pass the Bechdel test? To pass, a function written by a woman dev must call a function written by another woman dev.</p>&mdash; Laurie Voss (@seldo) <a href=\"https://twitter.com/seldo/status/571453200093437952?ref_src=twsrc%5Etfw\">February 27, 2015</a></blockquote>\n<script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-3175d7d5aed9c093038d0739895aae
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"3175d7d5aed9c093038d0739895aae":"1"},{"cachedAt":1718212425878,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-3175d7d5aed9c093038d0739895aae.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/enBloomMedia/status/519288750640480256","author_name":"Alisa Hughley, MPH","author_url":"https://twitter.com/enBloomMedia","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">Thank to the folks <a href=\"https://twitter.com/18F?ref_src=twsrc%5Etfw\">@18F</a> and <a href=\"https://twitter.com/hhsidealab?ref_src=twsrc%5Etfw\">@HHSIDEALab</a> for moving the <a href=\"https://twitter.com/hashtag/opensource?src=hash&amp;ref_src=twsrc%5Etfw\">#opensource</a> code of <a href=\"https://twitter.com/hashtag/Midas?src=hash&amp;ref_src=twsrc%5Etfw\">#Midas</a> forward; learned lots</p>&mdash; Alisa Hughley, MPH (@enBloomMedia) <a href=\"https://twitter.com/enBloomMedia/status/519288750640480256?ref_src=twsrc%5Etfw\">October 7, 2014</a></blockquote>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-41198981b42daba837eedfada4b325
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"41198981b42daba837eedfada4b325":"1"},{"cachedAt":1718212425579,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-41198981b42daba837eedfada4b325.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/monfresh/status/519297925965684736","author_name":"Moncef Belyamani","author_url":"https://twitter.com/monfresh","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">Had a great time at the <a href=\"https://twitter.com/18F?ref_src=twsrc%5Etfw\">@18F</a> hack night. Sent a PR to update installation instructions and fixed 2 bugs that <a href=\"https://twitter.com/saikofish?ref_src=twsrc%5Etfw\">@saikofish</a> found.</p>&mdash; Moncef Belyamani (@monfresh) <a href=\"https://twitter.com/monfresh/status/519297925965684736?ref_src=twsrc%5Etfw\">October 7, 2014</a></blockquote>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-4df3809831b720bb2338122a0a9fe7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"4df3809831b720bb2338122a0a9fe7":"1"},{"cachedAt":1718212425574,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-4df3809831b720bb2338122a0a9fe7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/corizarek/status/593525117210103809","author_name":"Cori Zarek","author_url":"https://twitter.com/corizarek","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">The <a href=\"https://twitter.com/hashtag/digitalservices?src=hash&amp;ref_src=twsrc%5Etfw\">#digitalservices</a> teams in the USG are AMAZING. Awesome demos today from <a href=\"https://twitter.com/18F?ref_src=twsrc%5Etfw\">@18F</a>, PIFs + <a href=\"https://twitter.com/USDS?ref_src=twsrc%5Etfw\">@USDS</a> at <a href=\"https://twitter.com/hashtag/moveforward100?src=hash&amp;ref_src=twsrc%5Etfw\">#moveforward100</a> <a href=\"http://t.co/2oZ491TUP2\">pic.twitter.com/2oZ491TUP2</a></p>&mdash; Cori Zarek (@corizarek) <a href=\"https://twitter.com/corizarek/status/593525117210103809?ref_src=twsrc%5Etfw\">April 29, 2015</a></blockquote>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-90d45473fd48f14202bed6b586de4c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"90d45473fd48f14202bed6b586de4c":"1"},{"cachedAt":1718212425880,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-90d45473fd48f14202bed6b586de4c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/thebenedict/status/578572813155590144","author_name":"Michael Benedict","author_url":"https://twitter.com/thebenedict","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\"><a href=\"https://twitter.com/18F?ref_src=twsrc%5Etfw\">@18F</a> Picture in tweet: screenshot of a tweet featuring a screenshot of a reply to a tweet featuring an image. <a href=\"http://t.co/PWUIJgubPd\">pic.twitter.com/PWUIJgubPd</a></p>&mdash; Michael Benedict (@thebenedict) <a href=\"https://twitter.com/thebenedict/status/578572813155590144?ref_src=twsrc%5Etfw\">March 19, 2015</a></blockquote>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-ac76c6912caf31b4258aca47327ad3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"ac76c6912caf31b4258aca47327ad3":"1"},{"cachedAt":1718212425042,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-ac76c6912caf31b4258aca47327ad3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/travelingheidi/status/578569906834264064","author_name":"Heidi Tandy (my tweets are not legal advice) 💫","author_url":"https://twitter.com/travelingheidi","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\"><a href=\"https://twitter.com/18F?ref_src=twsrc%5Etfw\">@18F</a> Since it doesn&#39;t work the same way in all apps, or if one goes back to earlier tweet days/months later can you link to earlier tweet.</p>&mdash; Heidi Tandy (my tweets are not legal advice) 💫 (@travelingheidi) <a href=\"https://twitter.com/travelingheidi/status/578569906834264064?ref_src=twsrc%5Etfw\">March 19, 2015</a></blockquote>\n<script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-c01364da60e21e17b304ecad867be6
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"c01364da60e21e17b304ecad867be6":"1"},{"cachedAt":1718212426138,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-c01364da60e21e17b304ecad867be6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/VLVarin/status/519229900516233216","author_name":"Vanessa Varin","author_url":"https://twitter.com/VLVarin","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">It&#39;s like CSI, but for <a href=\"https://twitter.com/hashtag/ux?src=hash&amp;ref_src=twsrc%5Etfw\">#ux</a> <a href=\"https://twitter.com/18F?ref_src=twsrc%5Etfw\">@18F</a> <a href=\"http://t.co/ZjltngriZ1\">pic.twitter.com/ZjltngriZ1</a></p>&mdash; Vanessa Varin (@VLVarin) <a href=\"https://twitter.com/VLVarin/status/519229900516233216?ref_src=twsrc%5Etfw\">October 6, 2014</a></blockquote>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-c456ffb390e7d85d92cd6382ae9f7e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"c456ffb390e7d85d92cd6382ae9f7e":"1"},{"cachedAt":1718212425877,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-c456ffb390e7d85d92cd6382ae9f7e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/USGSA/status/593540092871970817","author_name":"GSA","author_url":"https://twitter.com/USGSA","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">The <a href=\"https://twitter.com/USDS?ref_src=twsrc%5Etfw\">@USDS</a> and <a href=\"https://twitter.com/18F?ref_src=twsrc%5Etfw\">@18F</a> teams saying hi to <a href=\"https://twitter.com/DeniseUSGSA?ref_src=twsrc%5Etfw\">@DeniseUSGSA</a> at the <a href=\"https://twitter.com/hashtag/moveForward100?src=hash&amp;ref_src=twsrc%5Etfw\">#moveForward100</a> event. <a href=\"http://t.co/uncSFpyaEH\">pic.twitter.com/uncSFpyaEH</a></p>&mdash; GSA (@USGSA) <a href=\"https://twitter.com/USGSA/status/593540092871970817?ref_src=twsrc%5Etfw\">April 29, 2015</a></blockquote>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-c8be41e4b1a77adf6efb6dfe0dec48
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"c8be41e4b1a77adf6efb6dfe0dec48":"1"},{"cachedAt":1718212425055,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-c8be41e4b1a77adf6efb6dfe0dec48.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/18F/status/519227871311953920","author_name":"18F","author_url":"https://twitter.com/18F","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">The daytime <a href=\"https://twitter.com/hashtag/hackathon?src=hash&amp;ref_src=twsrc%5Etfw\">#hackathon</a> crew at work! Looking forward to what comes out of today&#39;s Midas hack: <a href=\"https://t.co/PYjHVwuJHu\">https://t.co/PYjHVwuJHu</a> <a href=\"http://t.co/OE273Sil0Z\">pic.twitter.com/OE273Sil0Z</a></p>&mdash; 18F (@18F) <a href=\"https://twitter.com/18F/status/519227871311953920?ref_src=twsrc%5Etfw\">October 6, 2014</a></blockquote>\n<script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-d29afdc5b25f847b412eb8708bd171
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"d29afdc5b25f847b412eb8708bd171":"1"},{"cachedAt":1718212425569,"type":"2"},"json"]
1 change: 1 addition & 0 deletions .cache/eleventy-fetch-d29afdc5b25f847b412eb8708bd171.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"url":"https://twitter.com/kimberlymunoz/status/578571119164264449","author_name":"Kimberly Muñoz","author_url":"https://twitter.com/kimberlymunoz","html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\"><a href=\"https://twitter.com/18F?ref_src=twsrc%5Etfw\">@18F</a> Would creating another account @18FImages to link + reply to tweets with descriptions be an option? It allows folks to turn it on/off.</p>&mdash; Kimberly Muñoz (@kimberlymunoz) <a href=\"https://twitter.com/kimberlymunoz/status/578571119164264449?ref_src=twsrc%5Etfw\">March 19, 2015</a></blockquote>\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https://twitter.com","version":"1.0"}
8 changes: 6 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require('fs');
const { EleventyRenderPlugin } = require('@11ty/eleventy');
const pluginRss = require('@11ty/eleventy-plugin-rss');
const pluginNavigation = require('@11ty/eleventy-navigation');
const embedTwitter = require('eleventy-plugin-embed-twitter');
const markdownIt = require('markdown-it');
const markdownItAttrs = require('markdown-it-attrs');
const markdownItAnchor = require('markdown-it-anchor');
Expand All @@ -20,7 +21,6 @@ const { readableDate
, teamLink
, markdownify
, weightedSort
, oembed
, asRelativeUrl
, matchPosts } = require('./config/filters');
const { postsCollection, servicesCollection, tagsCollection } = require('./config/collections');
Expand Down Expand Up @@ -80,6 +80,11 @@ module.exports = function (config) { /* eslint-disable-line func-names */
// Plugin to style code blocks
config.addPlugin(syntaxHighlight);

config.addPlugin(embedTwitter, {
cacheText: true,
cacheDuration: '*' // caches tweets forever
});

// Allow yaml to be used in the _data dir
config.addDataExtension('yml, yaml', contents => yaml.load(contents));

Expand All @@ -102,7 +107,6 @@ module.exports = function (config) { /* eslint-disable-line func-names */
// Add a link to an 18F team member's author page
config.addFilter('team_link', teamLink);
config.addFilter('weighted_sort', weightedSort);
config.addShortcode('oembed', oembed);
config.addFilter('relative_url', asRelativeUrl);
config.addFilter('match_posts', matchPosts);
config.addFilter('limit', (arr, limit) => arr.slice(0, limit));
Expand Down
56 changes: 0 additions & 56 deletions _plugins/oembed.rb

This file was deleted.

2 changes: 0 additions & 2 deletions assets/presentations/presentation-README.md

This file was deleted.

2 changes: 0 additions & 2 deletions config/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ const teamLink = (slug) => {
// TODO remove the eslint-disable directive after implementation
/* eslint-disable */
const weightedSort = (array, weight_name, sort_name) => array
const oembed = (url) => `TODO EMBED ${url}`
const asRelativeUrl = (url) => url
const matchPosts = (page, property='tags') => []
/* eslint-enable */
Expand All @@ -112,7 +111,6 @@ module.exports = {
teamLink,
markdownify,
weightedSort,
oembed,
asRelativeUrl,
matchPosts,
};
3 changes: 1 addition & 2 deletions content/posts/2014-04-28-18f-demo-day-may-9-2014.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ Space is limited, so [register today to join us at GSA on May
9.](https://www.eventbrite.com/e/18f-demo-day-tickets-11062384891). We
can't wait to see you there!

{{ "https://www.youtube-nocookie.com/embed/aeQX16HCKSs" | embed: 'register today to join us at GSA on May
9.' }}
{{ "https://www.youtube-nocookie.com/embed/aeQX16HCKSs" | embed: 'register today to join us at GSA on May 9.' }}

[Register at Eventbrite for 18F Demo
Day](https://www.eventbrite.com/e/18f-demo-day-tickets-11062384891)
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@ Midas is a [marketplace of skill building opportunities](https://18f.gsa.gov/201

More than 30 developers, designers, and government product leaders got together for an afternoon and evening of sketching, coding, writing and learning.

{% oembed "https://twitter.com/18F/status/519227871311953920" %}
https://twitter.com/18F/status/519227871311953920

### Positive impact

Thanks to the hack night, we had nine commits and 22 issues reported, seven of which were fixed within the week and integrated into the [next release](https://github.com/18F/midas/releases/tag/0.0.18) of the software. Some bugs were reported and fixed in the same evening! The usability testing confirmed some of our issues, but also offered some unexpected findings that informed future designs of the user interface. UX sketches were added to GitHub issues to resolve problems discovered in the usability testing. In addition to the direct contributions, the enthusiasm of the participants infused energy into our small team.

The event also had a positive impact on the participants themselves. Volunteers from the private sector learned about work across different agencies and new initiatives inside government.

{% oembed "https://twitter.com/monfresh/status/519297925965684736" %}
https://twitter.com/monfresh/status/519297925965684736

> "The Hackathon was great! I loved getting to quickly go from testing to creating a map of the issues. Then we modeled a potential solution and got practical feedback on it! We made a lot of progress in just one session! Everyone was really excited and open to the experience, and there were a lot of great ideas. I was so excited about the Hackathon that I told everyone at my office about it. I hope that we have more. Five Stars! Most fun day of work!" -- Ken Ambrose, Health and Human Services
{% oembed "https://twitter.com/enBloomMedia/status/519288750640480256" %}
https://twitter.com/enBloomMedia/status/519288750640480256

Government workers had the chance to meet people from other teams or other agencies who are doing similar work. Developers and designers using new technology and techniques sometimes feel isolated in their day-to-day work -- making connections to others in the same field can be transformative. Usability testing and UX sketching was new to a lot of participants, and it was exciting to see the findings from the testing sessions so quickly transformed into new ideas.

## How it worked

We split the room into two areas: on one side coding, the other side, user experience (UX). While the volunteer developers got their environments set up and worked on code or technical documentation improvements, the UX experience group worked with the Midas team to test different usage scenarios and identify a number of usability and design issues. The UX group even used the wall of the room to create a quick cluster map of the issues.

{% oembed "https://twitter.com/VLVarin/status/519229900516233216" %}
https://twitter.com/VLVarin/status/519229900516233216

Midas contributors from across the country were on hand to answer questions and merge in [pull requests](http://oss-watch.ac.uk/resources/pullrequest), and there were even volunteers working remotely on both design and development. The hackathon was split into afternoon and evening sessions, and a core group stayed for the whole event. In between the sessions, we had inspiring presentations from two government leaders – Read Holman from Health and Human Services and Lisa Nelson from GSA – who talked about how Midas has the potential to drive positive change across government.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ excerpt: "How does the Bechdel test, originally designed for evaluating works fo
Kaitlin Devine, 18F’s Director of Engineering recently noticed this
tweet:

{% oembed "https://twitter.com/seldo/status/571453200093437952" %}
https://twitter.com/seldo/status/571453200093437952

The coding Bechdel test, as described above, is a variant of the
original Bechdel test, which was created by writer and graphic novelist
Expand Down
Loading

0 comments on commit 82eda42

Please sign in to comment.