No internet connection
  1. Home
  2. Ideas

Turning media URLs into simple HTML previews of the resource

By Olti N @Itlox
    2018-11-28 18:51:36.837Z

    A feature that I would like to see here is that of turning media URLs into simple HTML previews of the resource. Something like the onebox feature of Discourse.org
    Onebox as a library is even free to use and can be implemented in other systems too https://github.com/discourse/onebox
    Another one is oEmbed https://oembed.com

    • 8 replies
    1. Hi Olti, nice hearing from you again :- )

      I think this is a good idea. In fact there is some basic support for oneboxes already, in Talkyard, but only for a few different things: YouTube videos, Giphy gifs, and images. If I paste a video link in a paragraph of its own:

      https://www.youtube.com/watch?v=j8VdehTuZfw
      

      then, the viedo gets embedded:

      ***

      Thanks for the link to Discourse's Onebox plugin :- ) That plugin is written in Ruby, but Talkyard in Scala, so I cannot use it. I did have a look long ago, at how Discourse implements oneboxes (including looking at that plugin I think), and got some ideas from that.

      I didn't know about oEmbed. Apparently Discourse uses oEmbed tags. Jeff Atwood says: (https://meta.discourse.org/t/quickly-explain-what-onebox-is/28114/16)

      Yes, onebox leverages OpenGraph and oEmbed tags, if present on the target site

      meaning, Talkyard should most likely do that too. So, at some later point in time, I'll look into oEmbed then :- ) Changing this topic to an Idea, status Planned.

      ***

      It'd be great to add more types of oneboxes :- ) For example, it should be possible to preview other Talkyard topics, and Discourse topics, and Wikipedia, ... Maybe Flarum? Reddit, HackerNews, WordPress, Ghost, Medium blogs. And ... maybe the way to make that happen, is ... If I make it simpler for other people to open-source contribute to Talkyard, so others can submit Git pull requests with oneboxes of their choice. I've noticed it takes too long for me to do "everything" myself :- P

      1. IOlti N @Itlox
          2018-12-20 17:19:14.118Z

          The very next thing to do here is to embed the links because you know, the most thing the users share are videos and links. For the videos you have the embedding implemented. The links are next. I like a lot how Discourse does this.

          https://try.discourse.org/t/the-room-appreciation-topic/289
          Is it too much of work to achieve sometime soon?

          1. I also like how Discourse does it (and Slack and others). Well, it would not be too much work to implement this now soon, ... if there hadn't been "too many" other things to do, too :- P

            I have in mind to make it simpler to contribute to Ty, and hopefully find people (maybe freelancers) who can help out with development, so things like this will happen sooner

        • In reply toItlox:
          @Mr.Nobody
            2023-08-26 00:40:42.127Z

            link-previews would be pretty cool. I am using the forum as a Wiki and for so many things I have to take screenshots etc, link previews would be much easier.

            I saw a tool handle it like this:

            • if the URL is inside a row like this, it is just a URL, and no link-preview is activated.
            • but it shows a link-preview if the URL is posted like this:

            Alone in a row

            1. What could be ways to make the "rules" about when link previews are generated, or not, more discoverable?

              Maybe there could be an edit icon next to links, in posts one has written oneself, and if one clicks the icon, a menu pops up and asks if you want to 1) follow the link (the default), or 2) add an inline link preview (just the title), or 3) add a whole block link preview (its own paragraph), or 4) edit the link title or URL. A bit like in Gmail: if you click a link, there's an Edit Link popup menu that lets you edit the title or URL.

              (And / or there could be something in the CommonMark Help ... dialog, but ... that's a lot less discoverable)

              What external sites do you want to / do-you-usually link to, if I can ask? Usually / sometimes a bit work needs to be done, to support a new external site. But some sites support something called oEmbed, and then it can be less work (or maybe nothing to do at all) to support link previews to them. But there can also be security issues, if embedding too happily :- / if the external embedded site gets compromised

              1. @Mr.Nobody
                  2023-08-28 17:22:28.447Z2023-08-31 19:39:54.942Z

                  Maybe there could be an edit icon next to links

                  love that idea :)

                  What external sites do you want?

                  Would it be possible to integrate with Twitter card attributes (twitter:title, twitter: description, etc)? Because then ANY webpage that works with Twitter link previews would also have link-previews on Talkyard. Also, it ensures the link previews look similar to other popular platforms, which I think is what most users will want/expect in that situation. There might even be an open source library for that.

                  1. Twitter cards — sounds like a good idea. Thanks for mentioning, I hadn't thought about.

                    Thanks for mentioning "no-follow" (in another thread) — that's a good thing to look into, at the same time: the pop up menu (mentioned above) could have radio buttons: (in addition to per-site default settings, e.g. Always follow links to: [__our.company.com___])

                     ( ) rel=follow    (x) rel=no-follow    ( ) rel=sponsored   ( ) rel=ugc
                    
              2. In reply toItlox:

                @Mr.Nobody The main thing that's been holding me back is actually not generating link previews, but instead a security problem called Server Side Request Forgery, which can arise when doing outbound network requests.

                But now I've read a bit about that, and I think I can start implementing some basic Twitter and OpenGraph previews soon, I'd guess this'll be available in about 4 weeks (initially probably without that nice dropdown dialog).

                1. Progress
                  with doing this idea
                2. @KajMagnus marked this topic as Planned 2018-11-30 07:45:13.955Z.
                3. I@Itlox marked this topic as Started 2018-12-20 17:12:01.060Z.
                4. @KajMagnus marked this topic as Done 2018-12-30 10:48:21.141Z.
                5. @KajMagnus marked this topic as New 2018-12-30 10:48:21.730Z.
                6. @KajMagnus marked this topic as Planned 2018-12-30 10:48:22.442Z.