Refactored template code

This commit is contained in:
Brandon Rozek 2022-05-08 18:02:35 -04:00
parent b28e531f9f
commit c3e09727a6
20 changed files with 332 additions and 395 deletions

View file

@ -1,10 +1,12 @@
{{ define "main"}}
{{ define "main" }}
{{ partial "header.html" . }}
<!-- content -->
<main>
<div id="contentBody">
{{ .Content }}
</div>
<main class="h-entry">
{{ .Scratch.Set "beforeDateString" "Published on "}}
{{ partial "date.html" . }}
<div class="e-content">
{{ .Content }}
</div>
</main>
{{ partial "footer.html" . }}
{{ end }}

View file

@ -3,7 +3,8 @@
"ref": "{{ $page.Permalink }}",
"title": {{ $page.Title | jsonify }},
"section": "{{ $page.Section }}",
"tags": {{ $page.Params.tags | jsonify }},
"date" : {{ $page.Date.Format "2006.01.02" | jsonify }},
"body": {{ $page.Plain | jsonify }}
}
{{ end }}]
{{ end }}]

View file

@ -1,24 +1,10 @@
{{ define "main"}}
{{ partial "header.html" . }}
<main>
{{ if not .Date.IsZero }}
<!-- date -->
{{ $singlePageDateFormat := .Site.Params.singlePageDateFormat | default "January 2, 2006"}}
<p class="date">{{ .Date.Format $singlePageDateFormat }}</p>
{{ end }}
<!-- tags -->
<div id="tags">
<ul>
{{ range .Param "tags" }}
{{ $name := . }}
{{ with $.Site.GetPage (printf "/tags/%s" ($name | urlize)) }}
<li><a href="{{ .Permalink }}">{{ $name }}</a></li>
{{ end }}
{{ end }}
</ul>
</div>
{{ partial "date.html" . }}
{{ partial "tags_list_page.html" . }}
<!-- content -->
<div id="contentBody">
<div class="e-content">
{{ .Content }}
</div>
</main>