Embedding Media

Because of working on web stuff for more than twenty years now, I often think, I know a lot of the common things regarding websites. Well, today I've been proven wrong once again.

                    

Something on this website was bugging me for a long time: The link previews. You know those little boxes showing a title, description and sometimes an image of the website I link to. I wrote a Kirby-Plugin for that – yes, another one.

The plugin isn't public, it's living on my site only. I was thinking of changing that, but before I could do so, I had to make changes. I don't want to go into details here, there were some unhandled error cases and sometimes the plugin wasn't able to do its job.

Which ultimately is: Find all URLs on a page I just saved in the Kirby Panel. Visit each URL and get meta information, like the title or OG-Image.

Broken previews were getting on my nerves, so I decided to start working on that, which I did with good success. I switched from a hacked-together-approach to a library helping me get the information.

And while I was looking at the results, I saw that one information which was stored in an object named code and which was an HTML-Snippet. I wondered what that could be and was stunned.

Those little HTML-Snippets were embed codes. So when I rendered them, I saw… eehm… things. I mean for example the full audio player of Pocket Casts was embedded:

Look at that! Wow! And I didn't have to do anything for that to work. Some Mastodon instances do the same, so when embedding a Mastodon-Post it shows the Post in a beautiful styled embed.

I didn't know websites were doing that. Call me stupid, I really never even thought about it. And a lot of websites do this. YouTube, Spotify and most of the WordPress blogs.

I was really excited! And I started to write some highly sophisticated PHP Code, which I was about to label as "Smart AI Feature", but because (as most of the time) it simply was a set of if statements, I didn't. It worked really nice. I saw the players and previews and really liked it. And then I removed it again.

Because I wasn't sure about privacy stuff. You know, those sites will probably track my visitors - we don't want that. So for now those embeds are disabled, and I will probably add an opt-in for them.

But beside all that, there is this feature I never heard about, I never thought about. And those are the moments I am really excited about my job, discovering something new, which even might be useful!

Updates about the plugin will follow - but I guess not before next year.