split the footer part for better structure

This commit is contained in:
Huy Tran 2018-01-22 10:03:55 +07:00
parent 365a5731ca
commit 514e9a167f
11 changed files with 120 additions and 101 deletions

View file

@ -2,9 +2,10 @@
<body class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}}">
{{ partial "sidebar.html" . }}
<div class="content container">
{{ block "main" . -}}{{- end }}
{{ block "main" . }}{{ end }}
</div>
{{ template "_internal/google_analytics_async.html" . }}
<div class="footer">
{{ block "footer" . }}{{ end }}
</div>
</body>
</html>

View file

@ -1,10 +1,19 @@
{{ define "main" -}}
<h1 class="title">Blog Posts</h1>
{{ define "main" }}
<h1 class="title">{{ .Title }}</h1>
<ul class="posts">
{{ range .Data.Pages -}}
<li>
<span><a href="{{ .Permalink }}">{{ .Title }}</a> <time class="pull-right post-list">{{ .Date.Format "Jan 2, 2006" }}</time></span>
</li>
{{- end }}
{{ range .Data.Pages -}}
<li>
<span><a href="{{ .Permalink }}">{{ .Title }}</a> <time class="pull-right post-list">{{ .Date.Format "Jan 2, 2006" }}</time></span>
</li>
{{- end }}
</ul>
{{- end }}
{{ define "footer" }}
<!-- Footer -->
<div>
{{ if .Site.GoogleAnalytics -}}
{{ template "_internal/google_analytics_async.html" . }}
{{- end}}
</div>
{{- end }}

View file

@ -33,9 +33,25 @@
{{ end }}
{{ .Content }}
</div>
{{ if .Site.DisqusShortname -}}
<h2>Comments</h2>
{{ template "_internal/disqus.html" . }}
{{- end }}
{{- end }}
{{ define "footer" -}}
{{ if .Site.Params.highlightjs }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{{ range .Site.Params.highlightjslanguages }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/{{.}}.min.js"></script>
{{ end }}
<script type="text/javascript">
hljs.initHighlightingOnLoad();
</script>
{{ end }}
<!-- Google Analytics -->
{{ if .Site.GoogleAnalytics }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
<!-- Disqus-->
{{ if .Site.DisqusShortname }}
<h2>Comments</h2>
{{ template "_internal/disqus.html" . }}
{{ end }}
{{- end }}