FREE tools

Use shortcodes to embed tweets, videos, etc. in your blogdown blog posts

Lukas Fuchs vor 3 Jahren Frontend-Entwicklung 3 Min. Lesezeit

Shortcodes are simple snippets inside your content files calling built-in or custom templates. This short post is a shout-out for the blogdown::shortcode() function. Example(s) of blogdown::shortcode() can be found in blogdown book. To learn more about shortcodes visit https://gohugo.io/content-management/shortcodes/.

Shortcodes make it super easy to embed content in blog posts. Lets say we have a video we want to embed in a post: https://youtu.be/CjTLN-FXiFA. By adding

```{r, eval=TRUE}
blogdown::shortcode("youtube", "CjTLN-FXiFA")
```

to our .Rmd file, we get:

https://web.archive.org/web/20221001165737if_/http://www.youtube.com/embed/CjTLN-FXiFA

How I discovered shortcodes

For some time I have had the routine of (scrolling twitter and) sending tweets holding information I see myself using to my e-mail. For example, I find @rensa_co’s example of dplyr::case_when() and geom_text() to be quite useful:

💡 dplyr::case_when goes really well with geom_text (or ggrepel) for when you want to programmatically label a few of the most interesting features in your #rstats plots! And the criteria can be as complex as you want 🎉 pic.twitter.com/0jUp1uarde— James Goldie (@rensa_co) March 21, 2018

So I sent it to my (work or personal - I’m not sure which) e-mail with hopes to easily find it in the future. One can experience the pain of the e-mail system after first time really looking for something. One can quickly understand that there must exist a better way. As I was looking for a way to archive all these pearls, I was thinking about devoting a blog post to those tweets. I started by looking for a way to embed twitter cards to blog post written with blogdown. I googeled “how to embed tweet in rmarkdown” which not surprisingly lead me to stackoverflow. This question was answered by Yihui and pointed to the blogdown documentation where I learned about shortcode() function.

FIN

After giving the blog post approach a second thought I realized that this is probably not gonna work. It seemed to be too much hassle to update the post manually or figure out how to automate the process. I ended up creating a #rhtwotes (rh - my initials; twote1 - twitter note/quote) and the plan is to retweet things I see myself using with #rhtwotes hashtag. This gives me easy access to my twotes whenever I have internet connections and also simplifies (retweeting is easier than sending an e-mail) note taking part.

For now, using the hashtag system feels quite natural and optimal way to cover my use case. I also ask myself: “How could I use something not as simple as retweeting system before?”. As it often happens, obvious solutions for our problems become obvious only after we have tried many not so obvious ones.

#rhtwotes


  1. I first had tnotes for twitter notes in mind. Fortunately ML proposed twote which has much better sounding. Word twote seems to have wider usage as well: https://www.urbandictionary.com/define.php?term=Twote

Weitere Beiträge

Folge uns

Neue Beiträge

Backend-Entwicklung

WordPress Development Workflow: So baust du Websites schneller, sauberer und skalierbar

AUTOR • Jul 11, 2026
Frontend-Entwicklung

Choosing a WordPress Menu Plugin: So findest du das beste Menü-Plugin für deine Website

AUTOR • Jul 11, 2026
Frontend-Entwicklung

The Best WordPress Plugin for Social Sharing: So findest du das richtige Tool

AUTOR • Jul 11, 2026
Performance & SEO

Optimize Images Plugin for WordPress: So machst du deine Website schneller ohne Qualitätsverlust

AUTOR • Jul 11, 2026
Performance & SEO

Google XML Sitemap WordPress Plugin Review: Lohnt sich das Plugin 2026 noch?

AUTOR • Jul 11, 2026
Webdesign & UX

WordPress Domain Search Plugins: Die besten Tools für eine schnelle, saubere Domain-Suche

AUTOR • Jul 11, 2026
Webdesign & UX

Why You Should Consider the MemberPress Lifetime Deal 2: Lohnt sich der Kauf wirklich?

AUTOR • Jul 11, 2026
Webdesign & UX

Alphanumerisches Passwort: So erstellst du sichere Passwörter, die du dir merken kannst

AUTOR • Jul 11, 2026
Webdesign & UX

Autokorrektur ausschalten: So deaktivierst du die Texterkennung auf iPhone, Android und am PC

AUTOR • Jul 11, 2026
APIs & Microservices

UDP Sockets verstehen und richtig nutzen: Der praxisnahe Guide für schnelle Netzwerkkommunikation

AUTOR • Jul 11, 2026
Webdesign & UX

Sperrmuster ändern: So passt du das Muster schnell und sauber an

AUTOR • Jul 10, 2026
Webdesign & UX

Outlook Formular erstellen: So baust du ein eigenes Formular in wenigen Schritten

AUTOR • Jul 10, 2026
Webdesign & UX

Slide Master PowerPoint: So baust du Folien schneller, sauberer und im Corporate Design

AUTOR • Jul 10, 2026
Webdesign & UX

Outlook Symbol Übersicht: Alle wichtigen Symbole in Outlook schnell verstehen

AUTOR • Jul 10, 2026
Webdesign & UX

Uhrzeit subtrahieren: So rechnest du Zeiten schnell und fehlerfrei

AUTOR • Jul 10, 2026
Backend-Entwicklung

Google Authenticator wiederherstellen mit QR-Code: So kommst du wieder in deine Accounts

AUTOR • Jul 09, 2026
Performance & SEO

How to Use a Broken Link Fix Tool: So findest und reparierst du defekte Links schnell

AUTOR • Jul 09, 2026
Webdesign & UX

Tastenbelegung ändern: So passt du deine Tastatur in Minuten an

AUTOR • Jul 09, 2026
Webdesign & UX

Schlüsselnummer finden: So findest du die richtige HSN und TSN schnell

AUTOR • Jul 09, 2026
Performance & SEO

How to find broken links on a website: Der schnelle Weg zu sauberem SEO

AUTOR • Jul 09, 2026

Beliebte Beiträge

Webdesign & UX

Die unzählbare Liste: Was ist das und wie nutzt man sie?

AUTOR • Jul 06, 2025
Webdesign & UX

Die perfekte Überschrift: Vorlagen für jeden Anlass

AUTOR • Jun 28, 2025
DevOps & Deployment

Windows Shell Scripts: Automatisierung leicht gemacht

AUTOR • Jun 27, 2025
Backend-Entwicklung

GMT und gmtime: Die Zeitfunktion in der Programmierung erklären

AUTOR • Jun 27, 2025
DevOps & Deployment

Die besten iPad Emulatoren für Windows im Überblick: So testest du Apps und Spiele

AUTOR • Jun 25, 2025
Performance & SEO

Softwarehunter Bewertung: Analytiert und Verglichen

AUTOR • Jun 24, 2025
Webdesign & UX

Schnellformatierung Normal: So bringst du deine Dokumente auf Vordermann

AUTOR • Jun 20, 2025
DevOps & Deployment

Alles, was Sie über den Mozilla Wartungsdienst wissen müssen

AUTOR • Jun 20, 2025
Webdesign & UX

Gelöschte Fotos Wiederherstellen: So Geht's!

AUTOR • Jun 19, 2025
Webdesign & UX

Excel Zeilen Ausklappen: So Organisieren Sie Ihre Tabellen Effizienter

AUTOR • Jun 14, 2025
Webdesign & UX

What Features Should an Automated Link Checker Have?

AUTOR • May 20, 2022
Performance & SEO

How to Find Broken Backlinks

AUTOR • May 20, 2022
Webdesign & UX

Instagram Fehler: Häufige Probleme und ihre Lösungen

AUTOR • Jul 24, 2024
Backend-Entwicklung

Die Verwendung von eval in PHP: Risiken, Vorteile und Best Practices

AUTOR • Sep 27, 2024
Performance & SEO

Import Startlayout: So gestaltest du deine Datei für den Import in Excel

AUTOR • Jul 16, 2025
APIs & Microservices

Was ist eine MSI Datei und wie kann man sie verwenden?

AUTOR • Jul 16, 2025
Backend-Entwicklung

Effiziente Umwandlung von Dezimalzahlen in Binärzahlen mit Python

AUTOR • Jul 16, 2025
Full-Stack

Der umfassende Leitfaden zum Thema Rahmenwerk: Was ist es und welche Bedeutung hat es?

AUTOR • Jul 15, 2025
Webdesign & UX

Benutzerprofil löschen: So gehen Sie vor – Die ultimative Anleitung

AUTOR • Jul 12, 2025
Backend-Entwicklung

Perl: Eine vielseitige Programmiersprache für Entwickler

AUTOR • Jul 10, 2025