add blog and recipe layouts

This commit is contained in:
Ben Charlton 2024-04-14 13:19:10 +01:00
parent 28a0467135
commit 7016e2a4f7
4 changed files with 80 additions and 0 deletions

15
layouts/blog/list.html Normal file
View file

@ -0,0 +1,15 @@
{{ define "main" -}}
<ul class="posts">
<h1>{{ .Title }}</h1>
{{ range .Data.Pages -}}
<li>
<div class="flex">
<a href="{{ .Permalink }}" class="truncate">{{ .Title }}</a>
{{ if eq .Kind "page" }}
<time class="nowrap" datetime="{{ .Date.Format "2006-01-02T15:04:05Z0700" }}">{{ .Date.Format "Jan 2, 2006" }}</time>
{{ end }}
</div>
</li>
{{- end }}
</ul>
{{- end }}

29
layouts/blog/single.html Normal file
View file

@ -0,0 +1,29 @@
{{ define "main" -}}
<div class="post">
<h1 class="title">{{ .Title }}</h1>
{{ with .Params.tagline }}<span class="tagline">{{ . }}</span>{{ end }}
{{ if ne .Type "page" -}}
<div class="post-date">
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z0700" }}">{{ .Date.Format "Jan 2, 2006" }}</time>
</div>
{{- end }}
<div>
{{ .Content }}
</div>
{{ partial "tags.html" . }}
{{ if (and (ne .Params.DisableShare true) (ne .Params.disable_share true)) -}}
{{ partial "share.html" . }}
{{- end }}
{{ if (and .Site.Config.Services.Disqus.Shortname (ne .Params.DisableComments true) (ne .Params.disable_comments true)) -}}
<div class="comments">
<h2>Comments</h2>
{{ template "_internal/disqus.html" . }}
</div>
{{- end }}
</div>
{{- end }}

12
layouts/recipes/list.html Normal file
View file

@ -0,0 +1,12 @@
{{ define "main" -}}
<ul class="posts">
<h1>{{ .Title }}</h1>
{{ range .Data.Pages.ByTitle -}}
<li>
<div class="flex">
<a href="{{ .Permalink }}" class="truncate">{{ .Title }}</a>
</div>
</li>
{{- end }}
</ul>
{{- end }}

View file

@ -0,0 +1,24 @@
{{ define "main" -}}
<div class="post">
<h1 class="title">{{ .Title }}</h1>
{{ with .Params.tagline }}<span class="tagline">{{ . }}</span>{{ end }}
<div>
{{ .Content }}
</div>
{{ partial "tags.html" . }}
{{ if (and (ne .Params.DisableShare true) (ne .Params.disable_share true)) -}}
{{ partial "share.html" . }}
{{- end }}
{{ if (and .Site.Config.Services.Disqus.Shortname (ne .Params.DisableComments true) (ne .Params.disable_comments true)) -}}
<div class="comments">
<h2>Comments</h2>
{{ template "_internal/disqus.html" . }}
</div>
{{- end }}
</div>
{{- end }}