feat: add subtitle typeit

This commit is contained in:
Dillon ZENG 2019-08-08 06:05:51 +08:00
parent 0b85b03f62
commit 5e55b25c8a
4 changed files with 19 additions and 8 deletions

View file

@ -16,10 +16,10 @@
</div>
{{ end }}
{{ with .Site.Params.subtitle}}
<h2 class="description">
{{ . }}
</h2>
{{ with .Site.Params.subtitle }}
<h2 class="description">
<div id="subtitle"></div>
</h2>
{{ end }}
</div>

View file

@ -12,8 +12,10 @@
<div class="avatar"><a href="/posts/"> <img src={{ $avatar }} alt="avatar"></a></div>
{{ end }}
{{ with .Site.Params.subtitle}}
<h2 class="description">{{ . }}</h2>
{{ with .Site.Params.subtitle }}
<h2 class="description">
<div id="subtitle"></div>
</h2>
{{ end }}
<div class="social-links">

View file

@ -36,11 +36,20 @@
{{ $countdown := `
<script src="https://cdn.jsdelivr.net/npm/jquery-countdown@2.2.0/dist/jquery.countdown.min.js" integrity="sha256-Ikk5myJowmDQaYVCUD0Wr+vIDkN8hGI58SGWdE671A8=" crossorigin="anonymous"></script>
` }}
{{ $jquery | safeHTML }}
{{ $typeit | safeHTML }}
{{ with .Site.Params.subtitle }}
<script>
if (!window.typeitMap) {
var typeitMap = {}
}
typeitMap["#subtitle"] = "{{ . }}";
</script>
{{ end }}
{{ if .IsPage }}
{{ $prettify | safeHTML }}
{{ $typeit | safeHTML }}
{{ $countdown | safeHTML }}
{{ $scripts = $scripts | append $dynamicToTop }}

View file

@ -7,7 +7,7 @@
{{ end }}
{{ $id = printf "#%s" $id }}
<script>
if (!typeitMap) {
if (!window.typeitMap) {
var typeitMap = {}
}
typeitMap["{{ $id }}"] = {{ .Inner | safeHTML }};