Description of your request or bug report: A use case that came up while talking with other people would be a way to access stats to make automatic “badges” showing how many books we have read this year, for instance. The idea is to have something to post on blogs or the like that we can use to keep track of yearly goal and the like (similar to this table but in a more automated way)
I am thinking about the kind of stuff you see on GitHub, such as
or maybe just a self expanding link, like the one for books, but instead showing the username and some stats.
Edit: what I came up with is this: , with C the number of Character-based books read this year, M manga, and T for total.
I am aware that Discourse bakes in the values, but if anyone edit the table ocne in a while, everything would be automatically updated at once. (Actually, it seems to work anyway?) Additionally, other places, like blogs, would be fine.
It’s a random widget I got from a github page I had open. I just inserted the code.
I assume the generation itself is done by github? I have no idea how widgets/badges/whatever you call that work in general.
Sure!
I went to Github, used random keywords until I found a repository with the thing I was looking for, right clicked on it, selected inspect element, control-c on the html code, then just control-v here.
Edit: You can see the code by using the quote full message, but just in case:
I see. So that’s just an image, not a widget. I don’t think it’s possible to allow 3rd party widgets into discourse. I could potentially create a stats image for you, but not sure what we want.
As far as doing the simple link text conversion like Naphthalene's profile | Natively, i could generate urls with a different page title that includes your book count, sure. Although I’m guessing it will be of somewhat limited use, as everyone has different needs?
Well, it is an image, but if the source change, then it would change too, right?
I feel like I could try myself once there’s a public API for the stats (that’s included in the API request, right?)
Right, in both cases, I feel like the user would want some degree of customization. As a start, though, the most common use case I see is how many books someone has read this year (as part of a yearly challenge). In some cases, people distinguish between manga and 活字 (character based) books.
Maybe something like Naphthalene (C51/M67/T118)
(Character-based/Manga/Total; although people will have to come to Natively to see the explanation, which seems like a good idea )
Images can be server-generated, but the URL needs to be changed as well, to prevent caching. Or Discourse needs to reset its cache somehow, if to use the same image URL.
Isn’t the status text already changing based on Natively website? (Only that not so fancy.)
AIUI they are server generated SVG images, served with either a fairly low cache lifetime or else instructions not to cache them at all; so whenever somebody loads a webpage that refers to one they’ll get an up to date image, not a stale one. GitHub - badges/awesome-badges: A curated collection of awesome things related to status badges seems like a good place to start if you’re interested in the technical details.
That would make sense. At first I wanted to post in the API thread, to be honest.
That being said, I’m afraid that it would get buried and forgotten if I just add the request there (plus I feel like it might be easier AND a good test of the API framework to implement this first; I may be biased though )
edit: the API isn’t even on the roadmap yet
2 Likes
As an Amazon Associate, Natively earns from qualifying purchases through any Amazon links on the site.