diff --git a/exampleSite/content/home/posts.md b/exampleSite/content/home/posts.md index 9a274b86..74256cec 100644 --- a/exampleSite/content/home/posts.md +++ b/exampleSite/content/home/posts.md @@ -20,5 +20,9 @@ tags_exclude = [] # Number of posts to list. count = 5 +# List format. +# 0 = Simple +# 1 = Detailed +list_format = 1 +++ diff --git a/exampleSite/content/post/_index.md b/exampleSite/content/post/_index.md index 2289860b..f21fa723 100644 --- a/exampleSite/content/post/_index.md +++ b/exampleSite/content/post/_index.md @@ -4,9 +4,13 @@ date = 2017-01-01 math = false highlight = false +# List format. +# 0 = Simple +# 1 = Detailed +list_format = 1 + # Optional featured image (relative to `static/img/` folder). [header] image = "" caption = "" - +++ diff --git a/layouts/partials/post_li.html b/layouts/partials/post_li_detailed.html similarity index 100% rename from layouts/partials/post_li.html rename to layouts/partials/post_li_detailed.html diff --git a/layouts/partials/post_li_simple.html b/layouts/partials/post_li_simple.html new file mode 100644 index 00000000..b4de9b71 --- /dev/null +++ b/layouts/partials/post_li_simple.html @@ -0,0 +1,6 @@ +{{ $post := .post }} + +
+ + +
diff --git a/layouts/partials/widgets/posts.html b/layouts/partials/widgets/posts.html index 96d7f0f6..cde9e827 100644 --- a/layouts/partials/widgets/posts.html +++ b/layouts/partials/widgets/posts.html @@ -45,7 +45,11 @@ {{ $show_post := $.Scratch.Get "show_post" }} {{ if ne $show_post "0" }} {{ $params := dict "post" . }} - {{ partial "post_li" $params }} + {{ if eq $page.Params.list_format 0 }} + {{ partial "post_li_simple" $params }} + {{ else }} + {{ partial "post_li_detailed" $params }} + {{ end }} {{end}} {{ end }} @@ -72,7 +76,11 @@ {{ $show_post := $.Scratch.Get "show_post" }} {{ if ne $show_post "0" }} {{ $params := dict "post" . }} - {{ partial "post_li" $params }} + {{ if eq $page.Params.list_format 0 }} + {{ partial "post_li_simple" $params }} + {{ else }} + {{ partial "post_li_detailed" $params }} + {{ end }} {{end}} {{ end }} diff --git a/layouts/section/post.html b/layouts/section/post.html index fcd5682b..614f37e5 100644 --- a/layouts/section/post.html +++ b/layouts/section/post.html @@ -14,7 +14,11 @@ {{ $paginator := .Paginate .Data.Pages }} {{ range $paginator.Pages }} {{ $params := dict "post" . }} - {{ partial "post_li" $params }} + {{ if eq $.Params.list_format 0 }} + {{ partial "post_li_simple" $params }} + {{ else }} + {{ partial "post_li_detailed" $params }} + {{ end }} {{ end }} {{ partial "pagination" . }}