Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Ghost Voice Reader

Ghost Voice Reader reads Ghost posts aloud with the browser's built-in voice. Install it through Ghost Code Injection. You do not need to edit your theme.

The reader does not need an account, an API key, or a speech provider. It does not send post text to AspireThemes.

Features

  • Shows a floating button on Ghost posts
  • Uses voices from the browser and operating system
  • Finds the post content automatically
  • Provides play, pause, resume, retry, and time controls
  • Divides long posts into short speech sections
  • Pauses when page audio or video starts
  • Starts reliably in iOS Safari
  • Supports keyboard focus, reduced motion, and high-contrast colors
  • Does not use analytics or cookies

Install

  1. Open Ghost Admin → Settings → Advanced → Code Injection.
  2. Paste this code into Site Footer:
<script
  src="https://cdn.jsdelivr.net/gh/aspirethemes/ghost-voice-reader@v1.0.0/dist/ghost-voice-reader.min.js"
  defer
></script>
  1. Select Save.
  2. Open a post.
  3. Confirm that the floating Listen button appears in the lower-left corner.

The version number keeps the installed reader stable when this project changes.

The reader starts only on a Ghost post. It does not start on home, tag, author, or page templates.

For more information, see Ghost's Code Injection guide and body_class reference.

Configure

Add only the settings that you need to the script element:

<script
  src="https://cdn.jsdelivr.net/gh/aspirethemes/ghost-voice-reader@v1.0.0/dist/ghost-voice-reader.min.js"
  data-voice-reader-position="bottom-left"
  data-voice-reader-rate="1"
  data-voice-reader-minimum-words="40"
  data-voice-reader-label-listen="Listen"
  data-voice-reader-label-pause="Pause"
  data-voice-reader-label-resume="Resume"
  defer
></script>
Setting Default Function
data-voice-reader-position bottom-left Use bottom-left or bottom-right.
data-voice-reader-content-selector Automatic Set the post-content CSS selector.
data-voice-reader-minimum-words 40 Hide the button on shorter posts.
data-voice-reader-rate 1 Set the speech speed from 0.5 to 2.
data-voice-reader-read-title true Read the post title.
data-voice-reader-label-listen Listen Set the idle label.
data-voice-reader-label-pause Pause Set the playing label.
data-voice-reader-label-resume Resume Set the paused label.
data-voice-reader-label-loading Loading audio Set the loading label.
data-voice-reader-label-retry Try again Set the error label.
data-voice-reader-label-minute min Set the time unit.

If your theme uses an uncommon content wrapper, set its CSS selector:

<script
  src="https://cdn.jsdelivr.net/gh/aspirethemes/ghost-voice-reader@v1.0.0/dist/ghost-voice-reader.min.js"
  data-voice-reader-content-selector=".publication-article-body"
  defer
></script>

Change the button color

Shadow DOM protects the button from theme styles. To change the button, add this CSS to Site Header:

<style>
ghost-voice-reader::part(button) {
  background: #2457ff;
}
</style>

The script loads ghost-voice-reader.css from the JavaScript directory.

If your site uses a strict Content Security Policy, allow the CDN in script-src and style-src. Otherwise, the button stays hidden.

Use the JavaScript API

The script adds this small API to window:

window.GhostVoiceReader.version;
window.GhostVoiceReader.init({position: 'bottom-right'});
window.GhostVoiceReader.destroy();

The script also sends these document events:

  • ghost-voice-reader:play
  • ghost-voice-reader:pause
  • ghost-voice-reader:stop
  • ghost-voice-reader:error

Content rules

The reader reads the post title, paragraphs, lists, quotations, and section headings.

The reader skips code, captions, navigation, forms, signup cards, header cards, and Ghost upgrade prompts.

Ghost controls member access. The reader can read only the content that Ghost shows to the current visitor.

Browser support

The reader needs window.speechSynthesis and SpeechSynthesisUtterance. If the browser does not provide these features, the button stays hidden.

The browser and operating system control voice availability and quality. The reader uses the page language and lets the platform select the voice.

Build

  1. Install the project packages:
npm install
  1. Build the release files:
npm run build

The build creates:

  • dist/ghost-voice-reader.js
  • dist/ghost-voice-reader.min.js
  • dist/ghost-voice-reader.css

License

MIT © AspireThemes

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages