Menu
SermonIndex · Developer API

Sermons on your site.

A random sermon from the library, with the preacher and a player, on any page that will take a line of HTML. No key, no account, nothing to maintain — and a different sermon every visit.

— sermons — preachers — topics — scripture references

Put a sermon on your page. One line of HTML, no account, no key, nothing to maintain. It picks a different sermon from the SermonIndex library on every load, shows the preacher, and plays the audio without sending your visitors anywhere else.

See it

The default

One sermon, portrait, summary, player, and a button for another.

Dark, three at a time

Set count and it becomes a shelf.

Sermon of the day

Same sermon for every visitor, all day, changing at midnight UTC.

On one theme

Filter by topic, preacher, or book of the Bible.

Compact

Turn off the portrait, summary and tags for a sidebar.

Your colour

One accent value ties it to your own design.

Why put this on your site

9 KB

One small request, cached at the edge. The widget adds no framework, no jQuery, no tracker and no cookie. It will not slow your page down.

27,555

Sermons with audio to draw from, by preachers your readers already trust — Ravenhill, Tozer, Washer, Spurgeon in print, and hundreds more.

0

Things to maintain. No key to rotate, no quota to watch, no account that can lapse. If we vanished tomorrow the worst that happens is an empty box.

∞

Fresh content on a page you never update again. A different sermon every visit gives people a reason to come back.

Put it on your page

Pick whichever of these suits the site you have. They all produce the same widget.

1. The one-liner

Paste this where you want the sermon to appear. The widget renders itself right there.

<script src="https://www.sermonindex.net/embed/sermon.js" data-sermonindex></script>

2. Into a box you control

Better when your layout wants the script in the footer and the widget somewhere else.

<div id="sermon"></div> <script src="https://www.sermonindex.net/embed/sermon.js" data-target="#sermon" data-theme="dark" data-count="2"></script>

3. As an HTML tag

Load the script once, then use the element as many times as you like.

<script src="https://www.sermonindex.net/embed/sermon.js"></script> <sermon-index theme="light" topic="revival"></sermon-index> <sermon-index theme="light" speaker="leonard-ravenhill"></sermon-index>

4. An iframe, for sites that strip scripts

Wix, Squarespace, WordPress.com and most church platforms will not run a third-party script but will allow an iframe. Options go on the query string.

<iframe src="https://www.sermonindex.net/embed/frame/?theme=light&count=1" style="width:100%;height:250px;border:0" loading="lazy" title="A sermon from SermonIndex"></iframe>

Sizing an iframe. The frame posts its height to the parent whenever it changes, so you can size it exactly if you want to. Everything still works if you ignore this and set a fixed height.

window.addEventListener('message', function (e) { if (e.data && e.data.sermonindex === 'height') { document.querySelector('iframe[title*="SermonIndex"]').style.height = e.data.height + 'px'; } });

5. Just the data

If you would rather draw it yourself, take the sermon and render your own markup. This is the same call the widget makes.

// one random sermon, as a plain object const [sermon] = await SermonIndex.random({ count: 1 }); console.log(sermon.title, sermon.speaker, sermon.audioUrl); // { id, title, url, speaker, speakerSlug, speakerImage, summary, // duration, audioUrl, cdnAudioUrl, topic, scripture, hasTranscript }

Or skip the widget altogether and read the endpoint directly — it is a static JSON file like everything else in the API.

curl https://api.sermonindex.net/v2/random/7

One particular sermon

To show a sermon you have chosen rather than a random one, give its id, the last part of its address in the API. It works in every method: data-sermon on the script tag or element, or ?sermon= on the iframe.

<iframe src="https://www.sermonindex.net/embed/frame/?sermon=1wFkr64FxUet9qyw" width="560" height="280" style="border:0;max-width:100%" loading="lazy"></iframe>

Every sermon page with audio also announces itself through oEmbed, so on platforms that support it, pasting the page's address is enough and the player appears by itself.

Options

Every option works in all five methods. As data- attributes on a script tag or element, as attributes on <sermon-index>, as query parameters on the iframe, or as keys in the JavaScript call.

OptionDefaultWhat it does
themeautolight, dark, or auto to follow the visitor's system setting.
accent#d4af37Any CSS colour. Used for the play button, portrait ring and links.
count1How many sermons to show, up to 10.
widthfull widthA number of pixels, or any CSS width. The widget never exceeds its container.
headingFree Audio SermonsThe title bar text. Set it to empty to remove the bar entirely.
rotateloadload for a new sermon every page view, daily for one that holds all day.
interval0Seconds between automatic changes. Never interrupts someone who is listening.
topic—A topic slug, e.g. revival. See the topic list.
speaker—A preacher slug, e.g. leonard-ravenhill.
book—An OSIS book code, e.g. ROM. See Book Codes.
playertrueSet false for a link-only card with no audio controls.
portraittrueShow the preacher's photograph.
summarytrueShow the one-line summary.
tagstrueShow the scripture reference and topic chips.
shuffletrueShow the button that fetches another sermon.
target_blankWhere links open. Use _self to keep people on your page.

A filter that matches nothing still shows a sermon. If you ask for a topic with very few audio sermons the widget searches a few more shards, and if it still comes up empty it drops the filter rather than showing your visitors an empty box.

How it works, briefly

The widget fetches one small file — about 9 KB over the wire — holding fifty ready-to-render sermons, and picks from it. That is the whole network cost. Pressing Another costs nothing further, and a second widget on the same page reuses the first one's data. The file is static and cached at the edge, so it is fast everywhere and it cannot fall over under load.

Audio plays from the Internet Archive mirror where one exists, falling back to our own CDN if Archive is slow to answer. Nothing is preloaded until someone presses play, so an unplayed widget costs your visitor no bandwidth at all. Only one sermon plays at a time, even across several widgets.

The whole thing lives inside a shadow root, which means your CSS cannot break it and it cannot leak into your CSS. It sets no cookies, stores nothing beyond a per-tab cache of that one file, and reports nothing back to us.

Making it your own

The script is plain JavaScript with no build step and no dependencies. Read it, take it, host it yourself if you would rather not depend on our CDN — it is right here. The only thing it needs from us is the /v2/random/ endpoint, and that is open to anyone.

If you build something with it we would like to see it. Write to sermonindex@gmail.com.

Built on the SermonIndex API — the same public endpoints anyone can use.

Everything we make is available for free because of a generous community of supporters.

Donate