Lesser Known Features of DEV — Embeds!
Michael Tharrington

Michael Tharrington @michaeltharrington

About: I'm a friendly, non-dev, cisgender guy from NC who enjoys playing music/making noise, hiking, eating veggies, and hanging out with my best friend/wife + our 3 kitties + 1 greyhound.

Location:
North Carolina
Joined:
Oct 24, 2017

Lesser Known Features of DEV — Embeds!

Publish Date: Apr 29 '24
38 13

It's been a minute since I've shared a post in this series, but I'm finally back to school y'all on another lesser-known feature of DEV. 🤜💥🤛

How to Use Embeds

A feature that gets frequently overlooked in our community is embeds.

In their simplest form embeds give you a cool way to embed things from other websites. For instance, GitHub repos, CodePen pens, YouTube videos, Spotify songs, etc.

The basic Markdown for embedding something is written as follows:

{% embed https://... %}

For example, to embed a YouTube video, I would write:

{% embed https://www.youtube.com/watch?v=dQw4w9WgXcQ %}

Which would create:

One Known Exception

We didn't always format our embeds like this! Thanks to an update from @aritdeveloper a while back 🙌, thankfully we have a mostly uniform method to write these. Check out this announcement when the update was made!

Now, I emphasize "mostly uniform" because there is one embed that doesn't follow the format.

Our only exception is CodePen which uses the following syntax:

{% codepen https://... %}

In the future, I think we will probs make this uniform with the others. I've logged this request here on GitHub... hmmm, maybe I should embed it here instead. 😉

CodePen Embeds Do Not Follow Our Embed Formula #20134

Describe the bug

CodePen embeds don't follow the formula we've established for embeds here:

{% embed https://... %}

You can get them to work by using the following embed syntaxes:

{% codpen https://... %}

To Reproduce

  1. Try to embed this CodePen on DEV {% embed https://codepen.io/cassidoo/pen/MyaWzp %}
  2. It fails.
  3. Try to embed a CodePen on DEV with the following syntax: {% codepen https://codepen.io/cassidoo/pen/MyaWzp %}
  4. It works!

Expected behavior

All embeds should use the following formula: {% embed https://... %}

I do think it'd be ideal if we could still allow folks to use the current formulas too. That way folks who are used to using these formulas don't think something has broken.

Additional context

Shoutout to @dumebii for pointing out this issue to me and for writing up this post to try and help folks with using embeds on DEV - https://dev.to/dumebii/how-to-use-embeds-on-your-dev-community-blogposts-3oe5.

That's That!

Anywho, if you have any embed questions, comments, requests, or anything else, feel free to hit me up here!

Comments 13 total

  • Thomas Bnt
    Thomas BntApr 29, 2024

    GitHub logo forem / forem

    For empowering community 🌱


    Forem 🌱

    For Empowering Community

    Build Status Build Status GitHub commit activity GitHub issues ready for dev GitPod badge

    Welcome to the Forem codebase, the platform that powers dev.to. We are so excited to have you. With your help, we can build out Forem’s usability, scalability, and stability to better serve our communities.

    What is Forem?

    Forem is open source software for building communities. Communities for your peers, customers, fanbases, families, friends, and any other time and space where people need to come together to be part of a collective See our announcement post for a high-level overview of what Forem is.

    dev.to (or just DEV) is hosted by Forem. It is a community of software developers who write articles, take part in discussions, and build their professional profiles. We value supportive and constructive dialogue in the pursuit of great code and career growth for all members. The ecosystem spans from beginner to advanced developers, and all are welcome to find their place…

  • Devarshi Shimpi
    Devarshi ShimpiApr 29, 2024

    This is cool, the way how all the embeds look!😎

  • Anmol Baranwal
    Anmol BaranwalApr 29, 2024

    I used to put Loom videos as a link, only to find out that they're supported for embedding on DEV. haha!

    Silly me 😆

    They even have a small feature where you can see the comments on their video.

    embed

    • Michael Tharrington
      Michael TharringtonApr 30, 2024

      YESS!! Thank you for mentioning Loom.

      I absolutely love Loom and have quite a big collection of Looms. I really outta just create a post here on DEV and drop a bunch of my Looms in there, haha!

  • adriens
    adriensApr 29, 2024

    I use embeds all the time, frankly speaking, this feature added to DEV.to opened API are the key factors that made me adopt it !

    🙏 It would be awesome if we could embed Kaggle Notebook and Datasets too

    • Michael Tharrington
      Michael TharringtonApr 30, 2024

      OOoo noted! I'll pass on your suggestions here for Kaggle Notebook and Datasets. Thx!

      • adriens
        adriensApr 30, 2024

        🤩

      • adriens
        adriensApr 30, 2024

        Thanks a lot for the fast and kind feedback <3

  • Mike Talbot ⭐
    Mike Talbot ⭐Apr 30, 2024

    I just love that you can do this:

    Or maybe this!

    • Michael Tharrington
      Michael TharringtonApr 30, 2024

      Hahaha! These are freaking great, Mike. 😂

      You win the comments section for this one. 🙌

  • Rimu@Dengtec
    Rimu@DengtecJan 15, 2025

    Thanks you so much!Your article helped me figure out how to embed a YouTube video.

Add comment