Incorporate the blurbs here on D&D?

A few months back @musiko implimented an awesome new feature here on the forum to automatically link up citations that appeared in posts, like MN 123, Snp1.6, etc.

One of my recent coding projects incorporates the blurbs found on SuttaCentral. So that got me wondering if it would be possible to somehow add a similar functionality here on the forum.

So, for example with the text above, an icon could appear after each citation:

The clicking on the icon could expand the blurb:

Or there could be a popup or something similar. Accessibitly would need to be considered (as it always should be) so that it was functional or at the very least not disruptive for screen readers.

No idea how feasible this would be. At the moment, the only way to get a blurb from the API, as far as I know, is to request the whole suttaplex card.

Thoughts?

5 Likes

Nice mockups! Thanks for thinking of us humble, phone users :blush:

2 Likes

It’s certainly possible, someone would just have to build the plugin. Discourse has matured into a pretty stable platform, so developing shouldn’t be too much of a problem.

Would that be a problem? It’s more data, sure, but not a huge amount. Why not just call the whole suttaplex and display it as a popup on click?

Sure! I admit I have a very naive sense of speed and size on these internet tubes.

My thinking was that the feature would be a half way point between knowing nothing about the sutta being cited and clicking away from the forum to go read it. All with the purpose of increasing individual’s understanding as well as improve the discussions that happen. And possibly making more people feel confident in participating. But those are really just theories.

Sure. I always had the idea that the suttaplex could be supplied as an API with a front end web component to render it, then it can be dropped into any website. Basically you need:

  • litelement (7kb gzipped)
  • the API data
  • the suttaplex templates (all up, about 17kb gzipped; I’m not sure how much of that is actually needed)

The templates and Litelement would be a once only cost, they are reused; the API data is per embed.

Wrap it up as <sc-suttaplex-embed> and you’re good to go.

You’d probably get it in 50kb? Maybe less if you really tried. The main thing you should not import are the fonts, which are over 1 MB. Okay for a website, not for an embed.

By way of comparison, a single tweet can use 25 network calls or more and take megabytes of bandwidth. Basically, on the modern web, if you’re not serving advertising and tracking, you’re a mile ahead.

I’m not really sure how it should be done exactly, but I do believe it would be quite simple to adapt our suttaplex to use on third-party websites. And I also suspect that if you try to build a different component or API, it’s going to be a lot of work, and any advantage over simply reusing what we have built will be trivial at best.

You’d probably be able to do it as a simplified version of the suttaplex; it’s modular, so you could probably omit, say, the parallels or the other language translations without too big of a deal.

1 Like