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

Performance & SEO

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

AUTOR • May 04, 2026
Webdesign & UX

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

AUTOR • May 04, 2026
APIs & Microservices

Webcatcher: Die revolutionäre Web-Scraping-Software

AUTOR • May 04, 2026
Webdesign & UX

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

AUTOR • May 04, 2026
Webdesign & UX

Die ultimative Anleitung zur Home Assistant Dokumentation in Deutsch

AUTOR • May 04, 2026
Frontend-Entwicklung

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

AUTOR • May 04, 2026
Datenbanken & ORM

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

AUTOR • May 04, 2026
Webdesign & UX

How to Use Friendly Captcha

AUTOR • May 04, 2026
Webdesign & UX

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

AUTOR • May 04, 2026
Webdesign & UX

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

AUTOR • May 04, 2026
Webdesign & UX

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

AUTOR • May 04, 2026
APIs & Microservices

Wie du Home Assistant Token richtig nutzt: Ein umfassender Leitfaden

AUTOR • May 04, 2026
Performance & SEO

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

AUTOR • May 04, 2026
Webdesign & UX

WLAN Duden: Die richtige Schreibweise für das kabellose Netzwerk

AUTOR • May 04, 2026
Webdesign & UX

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

AUTOR • May 04, 2026
Webdesign & UX

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

AUTOR • May 04, 2026
Backend-Entwicklung

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

AUTOR • May 04, 2026
Webdesign & UX

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

AUTOR • May 04, 2026
DevOps & Deployment

WLAN-Antenne selbst bauen – Schritt-für-Schritt-Anleitung im PDF

AUTOR • May 04, 2026
Webdesign & UX

Word Seiten ausblenden: So funktioniert's einfach und schnell

AUTOR • May 04, 2026

Beliebte Beiträge

Backend-Entwicklung

Pseudocode Beispiel: Effektives Programmieren leicht gemacht

AUTOR • Sep 27, 2024
Webdesign & UX

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

AUTOR • Jun 25, 2025
DevOps & Deployment

So installierst du den ComfyUI Manager: Eine Schritt-für-Schritt-Anleitung

AUTOR • Jun 17, 2025
DevOps & Deployment

Home Assistant Standard Port: Ein umfassender Leitfaden zur Konfiguration und Sicherheit

AUTOR • Dec 15, 2025
Webdesign & UX

Die Schritte zum effektiven Tab Löschen in Browsern

AUTOR • Jun 20, 2025
Performance & SEO

Effektive Nutzung von MS Teams Breakout Rooms für interaktive Meetings

AUTOR • Jun 26, 2025
Webdesign & UX

Numbered List Markdown

AUTOR • Apr 14, 2023
Full-Stack

Node-RED Anleitung: Der ultimative Einstieg in die visuelle Programmierung

AUTOR • Jul 15, 2025
DevOps & Deployment

So behebst du die Fehlermeldung 'Reolink Verbindung fehlgeschlagen'

AUTOR • Jan 14, 2026
Webdesign & UX

Die umfassende Outlook Symbol Übersicht: Verstehen und Nutzen

AUTOR • Mar 26, 2026
Performance & SEO

Excel Tabelle Größe Anpassen: So Optimieren Sie Ihre Arbeitsblätter

AUTOR • Jun 27, 2025
DevOps & Deployment

Drucker einrichten und nutzen unter Windows 11: Eine Schritt-für-Schritt-Anleitung

AUTOR • Jun 23, 2025
Performance & SEO

How to Encode Email Addresses

AUTOR • Dec 31, 2023
Webdesign & UX

Die besten Tipps, um alt Outlook zu bekommen und zu nutzen

AUTOR • Jun 12, 2025
Webdesign & UX

Die Lenovo Seriennummer finden: Eine Schritt-für-Schritt-Anleitung

AUTOR • Jun 26, 2025
Webdesign & UX

Der Speicherort von Screenshots mit Windows + Shift + S: Alles, was du wissen musst

AUTOR • Jun 21, 2025
Webdesign & UX

Serienbrief in Excel erstellen: Schritt-für-Schritt-Anleitung

AUTOR • Jul 01, 2025
Webdesign & UX

ANSI Converter: Simplify Text Formatting Effortlessly

AUTOR • Sep 04, 2024
Webdesign & UX

Outlook Klassisch Ansicht Einstellen: So gelingt es mühelos

AUTOR • Dec 15, 2025
Webdesign & UX

Excel CSV speichern mit Komma: Eine Schritt-für-Schritt-Anleitung

AUTOR • Jun 27, 2025