A partial archive of meta.discourse.org as of Tuesday July 18, 2017.

Mini (Inline) Onebox Support RFC

eviltrout

One thing we’re considering adding shortly is support for mini oneboxing. This could also be thought of as “inline” oneboxing.

The idea is that certain links would be replaced with text if they match supported hosts. Here’s how I think it could work:

Mini Spec

  1. A user inserts a link while composing

  2. The link must not be on a line by itself (regular oneboxing)

  3. The link must not already contain descriptive text in the form of [some text](url) or <a href="url">some text</a>

  4. The link must match a whitelist of supported “mini oneboxers”

If so, the link’s text will be replaced with an appropriate value. For example

  • When linking to another topic on the forum, it would display the topic title

  • When linking to a whitelisted site, it would display the contents of the og:title or <title> tag.

Other Ideas

I think it’s also worth trying embedding an emoji or favicon for the link. Wikipedia does this with external links:

neil

If we show the external-link-arrow glyph for these external links, we should probably do it for all (not just whitelisted). The favicon idea is neat though.

elijah

Replacing my <a href="url-goes-here">description about url</a> description about a url will break my in-line use of html links. The og:title (or whatever) is unlikely to fit in the sentence the same way. Am I misunderstanding this? Is it a proposal for adding a footer with that information? I look at that Wikipedia thing and think that it is just about the decoration around the links. That I’d have no issue with.

eviltrout

If the url has a description it will not be replaced. This will only happen on links that don’t have descriptions, for example

<a href="https://eviltrout.com">https://eviltrout.com</a>

or

[https://eviltrout.com](https://eviltrout.com)
David_Taylor

I think it would be good to have a way to ‘opt out’ of the mini-oneboxing, in the same way as we can opt out of normal oneboxing by putting a space before the link. That said, I can’t think of a tidy way that could be done inline, whitespace clearly won’t work…

sam

Some suggestions:

  • Always prefer opengraph/etc to title cause stuff like this is bad:

https://www.yelp.com/biz/hummus-kitchen-new-york

<title>Hummus Kitchen - Reservations - 340 Photos &amp; 598 Reviews - Middle Eastern - Theater District - New York, NY - Phone Number - Menu - Yelp</title>
  • If title is too long always truncate and add elipsis at some sane length. (site setting maybe)

  • To opt out easily use this syntax: <https://meta.discourse.org/t/mini-inline-onebox-support-rfc/66400/5> https://meta.discourse.org/t/mini-inline-onebox-support-rfc/66400/5 , very easily detectable in our engine.

  • We got to protect the Mini Onebox from hammering servers… should only request first N bytes of the page.

I like the external link icon, keep in mind some people may want to style it themselves for self owned domains and so on, so a class with the domain name would be nice. I would definitely avoid re-hosting and downloading custom favicons per site in the initial implementation, a default font-awesome icon for off-site is fine for the default. (also consider adding it optionally for any external links, at a minimum add a class on every A for internal vs external)

codinghorror

Why? This would be incredibly noisy from a visual standpoint… we already show click counts so now we’re showing a favicon on every link on top of that?

Also we kinda buried the lede here… we are only proposing this behavior when self-linking to your own Discourse instance, for v1 of this anyway.

So you’d only get this behavior when posting internal links to your own Discourse at least for v1.9. We could unlock “all links” behind a site setting perhaps for testing.

elijah

Well, the whitelisted domain part didn’t seem so buried lede to me. Maybe overthinking a V1 implementation. Or maybe the buried lede is self-links come whitelisted, and everything else is additional configuration.

But taking Wikipedia for example, there are many sister sites that are part of the same project but have different domains. Wikiquote, Wiktionary, Wikisource, etc. I like the idea of CSS styling that could be different for each. Sam’s class per domain would do that nicely.

To avoid clutter mini-onebox links like this could use a leading icon, or suppress showing a visit count (not suppress keeping one).