Website Badge Guide
This guide shows how to add the Route Bible website badge to your site and explains exactly what https://route.bible/badge.js does at runtime.
Quick start (copy/paste)
Paste this where you want the badge to render:
html
<div id="route-bible-badge"></div>
<script async src="https://route.bible/badge.js" data-mount="#route-bible-badge"></script>How to use it on your site
- Pick a location on your page (article footer, sermon page sidebar, resource card, etc).
- Add a container element (for example
div#route-bible-badge). - Add the
badge.jsscript tag withdata-mountpointing to that container. - Publish and verify the badge renders and opens Route Bible when clicked.
If your CMS supports raw HTML blocks, paste the same snippet into that block.
Fixed-passage badge (optional)
Use data-passage to force the badge to always open one passage:
html
<div id="route-bible-badge"></div>
<script
async
src="https://route.bible/badge.js"
data-mount="#route-bible-badge"
data-passage="JHN.3.16"
data-src="church-site"
></script>Use canonical passage format (JHN.3.16, ROM.8.28-30, etc). The script lowercases and URL-encodes the value before building the route URL.
Supported attributes
data-mount: CSS selector for where the badge should render.data-passage: fixed passage route target. If omitted, share-aware mode is used.data-src: source tag appended assrcquery param for fixed-passage mode.data-target: link target (_blankby default, or_selfif you want same-tab navigation).
How badge.js works
- Reads the script URL and uses that origin (normally
https://route.bible) for all generated URLs. - Chooses destination URL:
- With
data-passage: routes to/<passage>?mode=launcher(plussrcif provided). - Without
data-passage: routes to/share-targetwith the current page URL, page title, and meta description text (up to 512 chars).
- With
- Chooses render mount:
- first tries
data-mount - if missing/unresolved, falls back to script parent element (unless parent is
<head>) - then falls back to
document.body
- first tries
- Injects an anchor + badge image (
/route-bible-badge.svg) into the mount. - Prevents duplicate renders in the same mount by marking it with
data-route-bible-badge-rendered="true".
Expected click behavior
- Default mode (no
data-passage): Route Bible attempts to extract passage context from page metadata via/share-target, then redirects to canonical route flow. - Fixed mode (
data-passage): Route Bible opens that specific passage directly in launcher mode.
From there, users continue through normal Route Bible resolver behavior (app/deep-link when possible, with launcher and web fallback paths).
Troubleshooting
- Badge not visible:
- confirm
data-mountmatches an existing element. - confirm your site allows external script tags.
- confirm
- Badge appears in an unexpected location:
- your mount selector may not match; script then falls back to parent/body.
- Opens in a new tab but you want same tab:
- add
data-target="_self".
- add
- Fixed passage does not route as expected:
- use canonical passage format in
data-passage(for exampleJHN.3.16).
- use canonical passage format in