A 4kb mini interface for SuttaCentral.net suttas and Vinaya

Just a little thing:

gives a single sutta

gives: Sorry, “an1.328” is not a valid sutta citation.

https://sutta.readingfaithfully.org/ with an1.328
gives https://suttacentral.net/an1.316-332/en/sujato

1 Like

OK, That’s done. Could you take a look at how I did it and tell me if it makes sense/is the right way to do it? Previously, I was just using .toggle() but that won’t work anymore, eh?


Khantī paramaṁ tapo titikkhā,


So, for the sutta titles, I really want to keep the Pali there. I have removed it for the little list at the very top that shows the book, vagga, etc. And also for the subheadings within the suttas. If you had a suggestion on how to style the titles better, I’m very much open to that. Did you have a specific use case where you needed even the Pali in the titles hidden?

Right. That is expected at this point. That’s what the instruction Suttas that are part of a series require that you enter the exact series. means.

This is because the json files for the suttas that are part of a series contain the whole series. And I’m just pulling from the raw json files in the github repo.

Right. This I believe is a brand new feature. (Yay!) It is done somehow programmatically.

Yes! That’s because that app contains a table of all the suttas that are part of a series.

So if we wanted the same behaviour in mini-sc it would have to include all those tables as well as code to find a single sutta within a series. And so very quickly it wouldn’t be so mini.

I’ve been trying to figure out the API. This will probably be a better way to get all of the sutta data. However the ability to call on a single sutta within a series doesn’t seem to be part of the API yet. For example:
gives “Not Found”.

OK. That all makes perfect sense. So cool to have these tools. Thanks you very much Bhante!!

1 Like

TIL the .classname selector has less support than the lang selector (94.13% v 94.48%). Probably just an artefact of the data but still.

1 Like

looks about right! Except I’d just add/remove a “pali-hidden” class on the parent element for the whole shebang and do the rest in CSS:

div.pali-hidden span.pali-lang { display: none; }

1 Like

Doh! :man_facepalming:t2: So obvious now. Thanks!

Well, it’s really all just because Bhante Sujato is making all the data public.

If you have any ideas for other things, I’m always looking for practice projects.

1 Like

WAIT You know what I actually need? An interface this simple and clean which just searches the SuttaCentral edition of the PED. That would rule!


(whispers : the css is more expensive if you define element + class than if you just use the class. The browser has to match the class, then figure out if it matches the element. The general rule is, make selectors as complex as needed and no more.)

We should make a SuttaCentral Awesome page on Github that collects all the tools and stuff built on our data. Another one came up yesterday, a group in Malaysia is printing books.

Why don’t I do that, please remind me what I’ve forgotten:

1 Like

Would you be willing to download the whole dictionary at once? Bhante @sujato, is there a search or dictionary API?

1 Like

The search is all going to be changing so I wouldn’t build on it.


Sure! If I’m looking up one word, I’m probably looking up several.

Also, netlify allows you to specify the cache length on a per-file basis I believe. So you can set the wholedictionary.js file to have a really long cache and then it’ll only need to be downloaded once (per month or whatever)

1 Like

I just updated this to allow for Kp, Dhp, Ud, Iti, Snp, Thag, Thig. Dhp has to be in the form of verse ranges exactly for the whole chapter.


Cool! Also I added this to our Awesome page.

Thanks, Bhante. It’s really more of a test project, but maybe people will find it useful.

Right now it is getting it’s data directly from the github files. To me that seems like a really hacky way of doing things and that the “true” way would be to use the official API. Would you agree? Is it somehow wrong to be using the Github files?

No problem using the Github files. The API is really just “get the data from the Github files and assemble it in a way that is convenient for SC’s needs”. So it’s up to what you want to achieve.

Ah, that’s great. I had assumed that there was a “build” of the website on different servers and that the API was somehow pulling from that.

For sure getting the data from the API will be an improvement once it is working. Only need to call one file and it includes previous/next info.

1 Like

OK! So the code for this app has been rewritten so that the content of the sutta is pulled from the SC API instead of from the files hosted on GitHub. To the ordinary user this won’t matter at all. However it enabled me to easily add the previous and next suttas as links at the bottom.

The size of the downloded sutta information is slightly larger (a few kbs) but now there are only two fetch calls instead of three.

The original code can be found in this repository.



Now you can access Bhante Brahmali’s Vinaya translation with this tool. The code has to be slightly more complicated to figure out which authour to get, but the API works the same for sutta and vinaya.

I’ve also added some code so instead of typing pli-tv-bi-vb-ss1 you can just type bi-ss1.

It still requires a perfect citation, though.

Please share any feedback.


Thank you for that one! :heart: :+1: :grin:

1 Like

OK! So I’ve had to change the description in this part of the original post:

Is it really only 4kb?

Yes. And you get what you pay for, as you will see. There is no nothin’ except the Pali and English of the sutta and Vinaya. And the 4kb doesn’t count the data of the sutta itself. Just the interface. If you can even call it that.

Well, no. Not any more. It’s still really small. And after the first time you visit the page it should cache everything, so you really will just be downloading a few kb to get the body of the text. The biggest part is now the font, which is a custom subset of Roboto Serif, at ~20kb. I felt that this would give a better reading experience overall. There are also several icons that are less than a kb each. And lots of little interface improvements (including a dark mode) have bumped things up to about 19kb + the font + the actual sutta you want to download. So, yeah, it’s probably smaller than any web page you are going to visit this week. And getting it back down to ~5kb would simply be a matter of pulling out things that aren’t essential.

Hopefully all of the added features are worth the extra 35kb the page takes when it loads the first time.

The biggest changes are the font and the dark mode. This is the first time I’ve created a subset of a font, so hopefully I didn’t screw anything up. I’m also very open to suggestions on the styling of the dark mode.