0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Updated usage script to include site attribute

no issue

- To correctly inject the members.js script to any theme, it needs to know the correct site URL to access Ghost APIs.
- `data-ghost` attribute is needed on the script to define the correct Site url
This commit is contained in:
Rish 2020-09-04 17:19:37 +05:30
parent 1c2890036b
commit db9ca1322e

View file

@ -3,16 +3,20 @@
[![CI Status](https://github.com/TryGhost/members.js/workflows/Test/badge.svg?branch=master)](https://github.com/TryGhost/members.js/actions)
[![npm version](https://badge.fury.io/js/%40tryghost%2Fmembers-js.svg)](https://badge.fury.io/js/%40tryghost%2Fmembers-js)
Drop-in script to make the bulk of members work on any theme.
Drop-in script to make the bulk of Ghost membership features work on any theme.
## Usage
Add below script in your theme's `default.hbs` just before the end of body tag OR in the code injection footer in Ghost Admin.
```html
<script type="text/javascript" src="https://unpkg.com/@tryghost/members-js@latest/umd/members.min.js"></script>
<script defer src="https://unpkg.com/@tryghost/members-js@latest/umd/members.min.js" data-ghost="https://mymemberssite.com"></script>
```
The `data-ghost` attribute expects the URL for your site which is the only input Portal needs to work with your site's membership data via Ghost APIs.
NOTE: This is currently under active development and available only behind developer experiments flag - `enableDeveloperExperiments` in Ghost, which needs to be added to config file before starting the server.
### Custom trigger button
By default, the script adds a default floating trigger button on the bottom right of your page which is used to trigger the popup on screen.