From de08159806dd7763e2107e6effc2cf2fa57a067b Mon Sep 17 00:00:00 2001 From: nodejh Date: Thu, 25 Feb 2021 21:41:02 +0800 Subject: [PATCH] feat: add cover images --- layouts/index.html | 47 +++++++++++++++++++++++++++++++++++++++++--- static/css/style.css | 20 +++++++++++++++++-- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index aa4d823..a56079f 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -7,7 +7,7 @@ {{ range $paginator.Pages }} {{ $title := .Title }} {{ $summary := .Summary }} -
+ + + +
+ + {{ if .Resources.ByType "image" }} + + + {{ $images := .Resources.ByType "image" }} + {{ $image := index $images 1 }} + {{ range .Resources.ByType "image" }} + {{ if eq .Name "images/cover.png" }} + {{ $image = . }} + {{ else if eq .Name "images/cover.jpg" }} + {{ $image = . }} + {{ else if eq .Name "images/cover.jpeg" }} + {{ $image = . }} + {{ end }} + {{ end }} + + +
+

{{ $title }}

+
{{ $summary | plainify | htmlUnescape }}
+
+ +
+ {{ $title }} +
+ {{ else }} + + +
+

{{ $title }}

+
{{ .Date.Format "Jan 2" }}
+
+ +
{{ $summary | plainify | htmlUnescape }}
+ + {{ end }} + + +
{{ end }} diff --git a/static/css/style.css b/static/css/style.css index 475d53f..3444cba 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -224,7 +224,7 @@ nav.navigation a.button { /* index post list */ -#list-page .item { +/* #list-page .item { margin: 48px 0 0 0; } @@ -252,7 +252,7 @@ nav.navigation a.button { } #list-page .summary { - color: #6a737d; + color: #8c8c8c; margin-top: 12px; } @@ -265,4 +265,20 @@ nav.navigation a.button { #list-page .cover img { width: 100%; text-align: center; +} */ + +#list-page .item { + display: inline-block; +} + +#list-page .item .left { + float: left; +} +#list-page .item .right { + float: right; + width: 200px; + min-width: 200px; + max-height: 150px; + border-radius: 4px; + overflow: hidden; } \ No newline at end of file