Skip to main content

Widget Configuration

Customize the Earpocket widget using data attributes on the script tag.


Configuration Options

AttributeRequiredDefaultDescription
data-siteYesYour unique site identifier
data-positionNobottom-rightWidget position on the page
data-themeNoautoColor theme
data-api-urlNohttps://api.earpocket.comAPI endpoint
data-player-urlNohttps://play.earpocket.comWeb player URL
data-feeds-urlNohttps://feeds.earpocket.comRSS feeds URL

Position

Control where the widget button appears:

<!-- Bottom right (default) -->
<script src="..." data-site="..." data-position="bottom-right" async></script>

<!-- Bottom left -->
<script src="..." data-site="..." data-position="bottom-left" async></script>

<!-- Top right -->
<script src="..." data-site="..." data-position="top-right" async></script>

<!-- Top left -->
<script src="..." data-site="..." data-position="top-left" async></script>
ValueDescription
bottom-rightFixed to bottom-right corner (default)
bottom-leftFixed to bottom-left corner
top-rightFixed to top-right corner
top-leftFixed to top-left corner

Theme

The widget supports light and dark themes:

<!-- Auto-detect from system preference (default) -->
<script src="..." data-site="..." data-theme="auto" async></script>

<!-- Force light theme -->
<script src="..." data-site="..." data-theme="light" async></script>

<!-- Force dark theme -->
<script src="..." data-site="..." data-theme="dark" async></script>
ValueDescription
autoMatches user's system preference (default)
lightAlways use light theme
darkAlways use dark theme

Full Example

Here's a fully configured widget:

<script
src="https://api.earpocket.com/widget.js"
data-site="my-blog"
data-position="bottom-left"
data-theme="dark"
async
></script>

Local Development

For development environments, override the URLs:

<script
src="http://localhost:4000/widget.js"
data-site="dev-site"
data-api-url="http://localhost:8787"
data-player-url="http://localhost:3000"
data-feeds-url="http://localhost:8787/v1/feed"
async
></script>
Development Only

Never use localhost URLs in production. The default URLs will work automatically.


What's Next?