feat: use md5 and add more gitalk option
This commit is contained in:
parent
7fff7e482e
commit
f2abba4746
2 changed files with 8 additions and 4 deletions
|
@ -71,6 +71,8 @@ disqusShortname = 'YOUR_DISQUS_SHORTNAME' # use disqus comments
|
|||
clientSecret = 'gitalk client secret'
|
||||
repo = 'your gitalk repo'
|
||||
owner = 'owner github username'
|
||||
language = 'en' # en, zh-CN, zh-TW, es-ES, fr, ru, de, pl, ko, fa, ja
|
||||
distractionFreeMode = false # Facebook-like distraction free mode.
|
||||
```
|
||||
|
||||
Available options to front matter:
|
||||
|
|
|
@ -104,8 +104,9 @@
|
|||
<!-- Gitalk -->
|
||||
{{ if and .Site.Params.Gitalk.enable (not (eq .Params.comments false)) }}
|
||||
<div id="gitalk-container"></div>
|
||||
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
|
||||
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/md5-js/md5.min.js"></script>
|
||||
<script>
|
||||
const gitalk = new Gitalk({
|
||||
clientID: '{{ .Site.Params.Gitalk.clientID }}',
|
||||
|
@ -113,8 +114,9 @@
|
|||
repo: '{{ .Site.Params.Gitalk.repo }}',
|
||||
owner: '{{ .Site.Params.Gitalk.owner }}',
|
||||
admin: ['{{ .Site.Params.Gitalk.owner }}'],
|
||||
id: location.pathname, // Ensure uniqueness and length less than 50
|
||||
distractionFreeMode: false // Facebook-like distraction free mode
|
||||
id: md5(location.pathname),
|
||||
distractionFreeMode: Boolean('{{ .Site.Params.Gitalk.distractionFreeMode }}'), // Facebook-like distraction free mode\
|
||||
language: '{{ .Site.Params.Gitalk.language }}'
|
||||
});
|
||||
(function() {
|
||||
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue