show subscription buttons in simple view, add ability to hide rss button
This commit is contained in:
@@ -5,10 +5,9 @@ title: Frontend Configuration
|
||||
## Configuration
|
||||
|
||||
- **`host`**`: string` (required) – hostname of Remark42 server, same as REMARK_URL in backend config, e.g. "https://demo.remark42.com"
|
||||
- **`site_id`**`: string` (optional, `remark` by default) – the `SITE` that you passed to Remark42 instance on start of backend.
|
||||
- **`url`**`: string` (optional, `window.location.origin + window.location.pathname` by default) – url to the page with comments, it is used as unique identificator for comments thread
|
||||
- **`site_id`**`: string` (optional, `remark` by default) – the `SITE` that you passed to Remark42 instance on start of backend.
|
||||
- **`url`**`: string` (optional, `window.location.origin + window.location.pathname` by default) – url to the page with comments, it is used as unique identificator for comments thread
|
||||
Note that if you use query parameters as significant part of URL (the one that actually changes content on page) you will have to configure URL manually to keep query params, as `window.location.origin + window.location.pathname` doesn't contain query params and hash. For example, default URL for `https://example/com/example-post?id=1#hash` would be `https://example/com/example-post`
|
||||
|
||||
- **`components`**`: ['embed' | 'last-comments' | 'counter']` (optional, `['embed']` by default) – an array of widgets that should be rendered on a page. You may use more than one widget on a page.
|
||||
Available components are:
|
||||
- `'embed'` – basic comments widget
|
||||
@@ -19,9 +18,10 @@ title: Frontend Configuration
|
||||
- **`page_title`**`: string` (optional, `document.title` by default) – title for current comments page
|
||||
- **`locale`**`: enum` (optional, `'en'` by default) – interface localization, [check possible localizations](#locales)
|
||||
- **`show_email_subscription`**`: boolean` (optional, `true` by default) – enables email subscription feature in interface when enable it from backend side, if you set this param in `false` you will get notifications email notifications as admin but your users won't have interface for subscription
|
||||
- **`show_rss_subscription`**`: boolean` (optional, `true` by default) – enables RSS subscription feature in interface
|
||||
- **`simple_view`**`: boolean` (optional, `false` by default) – overrides the parameter from the backend minimized UI with basic info only
|
||||
|
||||
Example with all of the params:
|
||||
Example with all of the params:
|
||||
|
||||
```html
|
||||
<script>
|
||||
@@ -49,6 +49,7 @@ Add following **initialization** script after it.
|
||||
<script>!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);</script>
|
||||
```
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
## Comments
|
||||
|
||||
It's the main widget that renders a list of comments with ability of commenting.
|
||||
@@ -57,19 +58,19 @@ Add following snippet in the place where you want to see Remark42 widget. The co
|
||||
```html
|
||||
<div id="remark42"></div>
|
||||
```
|
||||
|
||||
::: note 💡
|
||||
**Note:** The initialization script should be placed after the code mentioned above.
|
||||
:::
|
||||
|
||||
If you want to set this up on a Single Page App, see the [appropriate doc page](https://remark42.com/docs/configuration/frontend/spa/).
|
||||
|
||||
|
||||
#### Themes
|
||||
|
||||
Remark42 has two themes: light and dark. You can pick one using a configuration object, but there is also a possibility to switch between themes in runtime. For this purpose, Remark42 adds to the `window` object named `REMARK42`, which contains a function `changeTheme`. Just call this function and pass a name of the theme that you want to turn on:
|
||||
|
||||
```js
|
||||
window.REMARK42.changeTheme('light');
|
||||
window.REMARK42.changeTheme("light")
|
||||
```
|
||||
|
||||
#### Locales
|
||||
@@ -89,10 +90,10 @@ Add this snippet to the bottom of web page, or adjust already present `remark_co
|
||||
```html
|
||||
<script>
|
||||
var remark_config = {
|
||||
host: 'REMARK_URL',
|
||||
site_id: 'YOUR_SITE_ID',
|
||||
components: ['last-comments'],
|
||||
};
|
||||
host: "REMARK_URL",
|
||||
site_id: "YOUR_SITE_ID",
|
||||
components: ["last-comments"],
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
@@ -116,10 +117,10 @@ Add this snippet to the bottom of web page, or adjust already present `remark_co
|
||||
```html
|
||||
<script>
|
||||
var remark_config = {
|
||||
host: 'REMARK_URL',
|
||||
site_id: 'YOUR_SITE_ID',
|
||||
components: ['counter'],
|
||||
};
|
||||
host: "REMARK_URL",
|
||||
site_id: "YOUR_SITE_ID",
|
||||
components: ["counter"],
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
@@ -139,4 +140,3 @@ And then add a node like this in the place where you want to see a number of com
|
||||
You can use as many nodes like this as you need to. The script will find all of them by the class `remark__counter`, and it will use the `data-url` attribute to define the page with comments.
|
||||
|
||||
Also, the script can use `url` property from `remark_config` object or `window.location.origin + window.location.pathname` if nothing else is defined.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user