clean structure of layouts/ and add support for taxonomys

This commit is contained in:
Hanwen Guo 2022-08-27 21:24:22 +08:00
parent 550b0f47b7
commit 10130c4963
7 changed files with 32 additions and 34 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ $.Site.LanguageCode }}" class="han-init">
<html lang="{{ $.Site.LanguageCode }}" class="{{- if $.Site.Params.hasCJKLanguage -}} {{- "han-init" -}} {{- end -}}">
{{- partial "head.html" . -}}
<body a="{{ $.Site.Params.theme_config.appearance | default "auto" }}">
<main class="page-content" aria-label="Content">

View File

@ -0,0 +1,8 @@
{{ define "main" }}
{{ partial "back_link.html" .}}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ partial "post_list.html" (dict "context" .)}}
{{ end }}

View File

@ -0,0 +1,8 @@
{{ define "main" }}
{{ partial "back_link.html" .}}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ partial "post_list.html" (dict "context" .)}}
{{ end }}

View File

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html lang="{{ $.Site.LanguageCode }}" class="han-init">
{{- partial "head.html" . -}}
<body a="{{ $.Site.Params.theme_config.appearance | default "auto" }}">
<main class="page-content" aria-label="Content">
<div class="w">
{{- block "main" . }}{{- end }}
</div>
</main>
<script src="https://cdn.jsdelivr.net/npm/han-css@3/dist/han.min.js"></script>
</body>
</html>

View File

@ -8,6 +8,10 @@
{{- end -}}
</li>
{{- if $item.entries }}
{{ partial "menu_item.html" (dict "context" . "collection" $item.entries) }}
{{- end -}}
{{- if $item.post_list -}}
{{ partial "post_list.html" (dict
"context" .
@ -18,9 +22,5 @@
"show_more_url" $item.post_list.show_more_url
) -}}
{{- end -}}
{{- if $item.entries }}
{{ partial "menu_item.html" (dict "context" . "collection" $item.entries) }}
{{- end -}}
{{- end -}}
</ul>

View File

@ -3,7 +3,15 @@
{{- if .section -}}
{{- $posts = (where site.RegularPages "Section" .section) -}}
{{- else -}}
{{- if (eq .context.Kind "taxonomy") -}}
{{- $posts = .context.Pages -}}
{{- else -}}
{{- if (eq .context.Kind "term") -}}
{{- $posts = .context.Data.Pages -}}
{{- else -}}
{{- $posts = site.RegularPages }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $limit_exceeded:= "" -}}

View File

@ -1,13 +0,0 @@
{{ if .IsNamedParams }}
{{ with .Get "text" }}
<hr data-content='{{ . }}' />
{{ else }}
<hr />
{{ end }}
{{ else }}
{{ with .Get 0 }}
<hr data-content="{{ . }}" />
{{ else }}
<hr />
{{ end }}
{{ end }}