FREE tools

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

Lukas Fuchs vor 3 Jahren 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

Beitrag

Using a 404 Error Checker

AUTOR • Apr 23, 2026
Beitrag

Outlook automatisch starten in Windows 11: Eine Schritt-für-Schritt-Anleitung

AUTOR • Apr 23, 2026
Beitrag

How to Format Your Text With Markdown Quotes

AUTOR • Apr 23, 2026
Beitrag

Free WordPress Editor

AUTOR • Apr 23, 2026
Beitrag

How to Fix the Empty Reply From Server Error

AUTOR • Apr 23, 2026
Beitrag

Can't PreventDefault Inside Passive Event Listener

AUTOR • Apr 23, 2026
Beitrag

How to Fix a "F.TXT Js" Problem

AUTOR • Apr 23, 2026
Beitrag

How to Remove the Player Location Check Plugin

AUTOR • Apr 23, 2026
Beitrag

Scan Website For Broken Links

AUTOR • Apr 23, 2026
Beitrag

Pagelayer Vs Elementor - Which WordPress Theme Should You Choose?

AUTOR • Apr 23, 2026
Beitrag

Hochgestellte Zahlen ganz einfach eingeben: Die besten Tastenkombinationen

AUTOR • Apr 15, 2026
Beitrag

So nutzen Sie CMD, um Geräte im Netzwerk anzuzeigen

AUTOR • Apr 15, 2026
Beitrag

Die richtigen Firewall-Ports für WSUS: So konfigurieren Sie Ihre Sicherheitsrichtlinien

AUTOR • Apr 15, 2026
Beitrag

Das perfekte Energie Dashboard: Home Assistant individuell anpassen

AUTOR • Apr 15, 2026
Beitrag

So kopierst du Tabellen in Word mit der richtigen Formatierung

AUTOR • Apr 15, 2026
Beitrag

Smileys in Word Einfügen: So geht's einfach und schnell!

AUTOR • Apr 15, 2026
Beitrag

Home Assistant auf Ubuntu installieren: Schritt-für-Schritt-Anleitung

AUTOR • Mar 26, 2026
Beitrag

Excel: Zellen bis zum Ende markieren – So gelingt’s mühelos!

AUTOR • Mar 26, 2026
Beitrag

Die ultimative Anleitung zu WLED und Home Assistant: So integrierst du deine LED-Streifen

AUTOR • Mar 26, 2026
Beitrag

Die umfassende Outlook Symbol Übersicht: Verstehen und Nutzen

AUTOR • Mar 26, 2026

Beliebte Beiträge

Beitrag

So änderst du die Zeit des Sperrbildschirms in Windows 11 – Ein umfassender Guide

AUTOR • Jun 27, 2025
Beitrag

Outlook Konto gesperrt? So behebst du das Problem schnell und einfach!

AUTOR • Jun 19, 2025
Beitrag

Wie du Home Assistant Token richtig nutzt: Ein umfassender Leitfaden

AUTOR • Jun 14, 2025
Beitrag

optimal-website-performance-seo-checker-audit-guide-xdb

AUTOR • Feb 08, 2024
Beitrag

So integrierst du die Home Assistant App auf Windows – Eine Schritt-für-Schritt-Anleitung

AUTOR • Dec 15, 2025
Beitrag

Word Seiten ausblenden: So funktioniert's einfach und schnell

AUTOR • Jun 14, 2025
Beitrag

Tastaturbelegung ändern in Windows 11: So einfach geht's!

AUTOR • Jun 23, 2025
Beitrag

So fügen Sie einen Haken in Outlook ein – Schritt-für-Schritt-Anleitung

AUTOR • Jun 27, 2025
Beitrag

Wie du dein Google Konto Altersbeschränkungen bestätigen kannst

AUTOR • Jun 12, 2025
Beitrag

Excel: Zellen nach Farbe wertvoll machen – Mit diesen Tricks wird's einfach!

AUTOR • Jun 18, 2025
Beitrag

So formatierst du FAT32 unter Linux: Eine Schritt-für-Schritt-Anleitung

AUTOR • Jun 27, 2025
Beitrag

Die ultimative Anleitung zur Home Assistant Dokumentation in Deutsch

AUTOR • Jun 14, 2025
Beitrag

How to Use Friendly Captcha

AUTOR • Feb 22, 2024
Beitrag

Node-RED Dashboard Aufrufen: Schritt-für-Schritt-Anleitung für Einsteiger

AUTOR • Jun 14, 2025
Beitrag

Die besten Schritte zur Installation des Realtek WLAN Treibers unter Windows 11

AUTOR • Jun 23, 2025
Beitrag

Der Fully Kiosk Browser für Home Assistant: Eine umfassende Anleitung auf Deutsch

AUTOR • Jan 14, 2026
Beitrag

UTF-8 und Umlaute: Alles, was Sie wissen müssen

AUTOR • Apr 12, 2025
Beitrag

Pseudocode Beispiel: Effektives Programmieren leicht gemacht

AUTOR • Sep 27, 2024
Beitrag

Die besten Methoden zum Virus entfernen: So bleibst du sicher im Netz

AUTOR • Jun 25, 2025
Beitrag

Die Schritte zum effektiven Tab Löschen in Browsern

AUTOR • Jun 20, 2025