Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
feat: add subtitle typeit
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq committed Aug 7, 2019
1 parent 0b85b03 commit 5e55b25
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
8 changes: 4 additions & 4 deletions layouts/partials/home_post.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 4 additions & 2 deletions layouts/partials/home_profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
11 changes: 10 additions & 1 deletion layouts/partials/js.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,20 @@
{{ $countdown := `
<script src="https://cdn.jsdelivr.net/npm/[email protected]/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 }}

Expand Down
2 changes: 1 addition & 1 deletion layouts/shortcodes/typeit.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ end }}
{{ $id = printf "#%s" $id }}
<script>
if (!typeitMap) {
if (!window.typeitMap) {
var typeitMap = {}
}
typeitMap["{{ $id }}"] = {{ .Inner | safeHTML }};
Expand Down

0 comments on commit 5e55b25

Please sign in to comment.