From a229b2175fb852312d9987ed59d1144ee994cfa3 Mon Sep 17 00:00:00 2001 From: Hanze Dong Date: Thu, 2 May 2024 18:26:33 +0800 Subject: [PATCH] Revert "Remove layout configs" This reverts commit 039b99d5b29aebfe0c966156c3d5b26f32da5437. --- layouts/_default/list.html | 123 +++++++++++++++++++++++++++++++++++ layouts/_default/single.html | 79 ++++++++++++++++++++++ 2 files changed, 202 insertions(+) create mode 100644 layouts/_default/list.html create mode 100644 layouts/_default/single.html diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..690d248 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,123 @@ +{{- define "main" }} + +{{- if (and site.Params.profileMode.enabled .IsHome) }} +{{- partial "index_profile.html" . }} +{{- else }} {{/* if not profileMode */}} + +{{- if not .IsHome | and .Title }} + +{{- end }} + +{{- if .Content }} +
+ {{- if not (.Param "disableAnchoredHeadings") }} + {{- partial "anchored_headings.html" .Content -}} + {{- else }}{{ .Content }}{{ end }} +
+{{- end }} + +{{- $pages := union .RegularPages .Sections }} + +{{- if .IsHome }} +{{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }} +{{- $pages = where $pages "Params.hiddenInHomeList" "!=" "true" }} +{{- end }} + +{{- $paginator := .Paginate $pages }} + +{{- if and .IsHome site.Params.homeInfoParams (eq $paginator.PageNumber 1) }} +{{- partial "home_info.html" . }} +

Latest Posts

+{{- end }} + + +{{- $term := .Data.Term }} +{{- range $index, $page := $paginator.Pages }} + +{{- $class := "post-entry" }} + +{{- $user_preferred := or site.Params.disableSpecial1stPost site.Params.homeInfoParams }} +{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) (not $user_preferred)) }} +{{- $class = "first-entry" }} +{{- else if $term }} +{{- $class = "post-entry tag-entry" }} +{{- end }} + +
+ {{- $isHidden := (.Param "cover.hiddenInList") | default (.Param "cover.hidden") | default false }} + {{- partial "cover.html" (dict "cxt" . "IsSingle" false "isHidden" $isHidden) }} +
+

+ {{- .Title }} + {{- if .Draft }} + + + + + + {{- end }} +

+
+ {{- if (ne (.Param "hideSummary") true) }} +
+

{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}

+
+ {{- end }} + {{- if not (.Param "hideMeta") }} +
+ {{- partial "post_meta.html" . -}} +
+ {{- end }} + +
+{{- end }} + +{{- if gt $paginator.TotalPages 1 }} + +{{- end }} + +{{- end }}{{/* end profileMode */}} + +{{- end }}{{- /* end main */ -}} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..3e57f83 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,79 @@ +{{- define "main" }} + + + + + + +
+
+ {{ partial "breadcrumbs.html" . }} +

+ {{ .Title }} + {{- if .Draft }} + + + + + + {{- end }} +

+ {{- if .Description }} +
+ {{ .Description }} +
+ {{- end }} + {{- if not (.Param "hideMeta") }} + + {{- end }} +
+ {{- $isHidden := (.Param "cover.hiddenInSingle") | default (.Param "cover.hidden") | default false }} + {{- partial "cover.html" (dict "cxt" . "IsSingle" true "isHidden" $isHidden) }} + {{- if (.Param "ShowToc") }} + {{- partial "toc.html" . }} + {{- end }} + + {{- if .Content }} +
+ {{- if not (.Param "disableAnchoredHeadings") }} + {{- partial "anchored_headings.html" .Content -}} + {{- else }}{{ .Content }}{{ end }} +
+ {{- end }} + + + + {{- if not (.Param "noComments") }} + {{- partial "comments.html" . }} + {{- end }} +
+ +{{- end }}{{/* end main */}}