mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 20:13:31 +08:00
Merge branch 'master' into master
This commit is contained in:
commit
7207871fce
@ -7,6 +7,9 @@ title: Example Site
|
|||||||
# Change it to your Disqus shortname before using
|
# Change it to your Disqus shortname before using
|
||||||
disqusShortname: hugo-theme-stack
|
disqusShortname: hugo-theme-stack
|
||||||
|
|
||||||
|
# GA Tracking ID
|
||||||
|
googleAnalytics:
|
||||||
|
|
||||||
# Theme i18n support
|
# Theme i18n support
|
||||||
# Available values: en, fr, id, ja, ko, pt-br, zh-cn
|
# Available values: en, fr, id, ja, ko, pt-br, zh-cn
|
||||||
DefaultContentLanguage: en
|
DefaultContentLanguage: en
|
||||||
@ -50,7 +53,6 @@ params:
|
|||||||
repo:
|
repo:
|
||||||
issueTerm: pathname
|
issueTerm: pathname
|
||||||
label:
|
label:
|
||||||
theme: preferred-color-scheme
|
|
||||||
|
|
||||||
widgets:
|
widgets:
|
||||||
enabled:
|
enabled:
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<script src="https://utteranc.es/client.js"
|
<script src="https://utteranc.es/client.js"
|
||||||
repo="{{ .Site.Params.comments.utterances.repo }}"
|
repo="{{ .Site.Params.comments.utterances.repo }}"
|
||||||
issue-term="{{ .Site.Params.comments.utterances.issueTerm }}"
|
issue-term="{{ .Site.Params.comments.utterances.issueTerm }}"
|
||||||
theme="{{ .Site.Params.comments.utterances.theme }}"
|
|
||||||
{{ with .Site.Params.comments.utterances.label }}
|
{{ with .Site.Params.comments.utterances.label }}
|
||||||
label="{{ . }}"
|
label="{{ . }}"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
async>
|
async
|
||||||
|
>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -16,16 +16,25 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('onColorSchemeChange', (e) => {
|
function setUtterancesTheme(theme) {
|
||||||
let utterances = document.querySelector('.utterances iframe');
|
let utterances = document.querySelector('.utterances iframe');
|
||||||
if (utterances) {
|
if (utterances) {
|
||||||
utterances.contentWindow.postMessage(
|
utterances.contentWindow.postMessage(
|
||||||
{
|
{
|
||||||
type: 'set-theme',
|
type: 'set-theme',
|
||||||
theme: `github-${e.detail}`
|
theme: `github-${theme}`
|
||||||
},
|
},
|
||||||
'https://utteranc.es'
|
'https://utteranc.es'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventListener('message', event => {
|
||||||
|
if (event.origin !== 'https://utteranc.es') return;
|
||||||
|
setUtterancesTheme(document.body.dataset.scheme)
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('onColorSchemeChange', (e) => {
|
||||||
|
setUtterancesTheme(e.detail)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
@ -21,4 +21,5 @@
|
|||||||
<link rel="shortcut icon" href="{{ . }}" />
|
<link rel="shortcut icon" href="{{ . }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{- template "_internal/google_analytics_async.html" . -}}
|
||||||
{{- partial "head/custom.html" . -}}
|
{{- partial "head/custom.html" . -}}
|
Loading…
Reference in New Issue
Block a user