diff options
author | Wang Chucheng <me@wangchucheng.com> | 2021-10-04 05:58:19 +0300 |
---|---|---|
committer | Wang Chucheng <me@wangchucheng.com> | 2021-10-04 05:58:19 +0300 |
commit | 920c3cce3e7004718c997045c05501a00195f056 (patch) | |
tree | 73fffd49053e895ed73e96b4965b598c0a3c73f7 | |
parent | 82a2d12ff8b42572b4278b597b92ed230b82acd6 (diff) |
fix: display description when exists
Closes #136
-rw-r--r-- | layouts/partials/components/summary-masonry.html | 6 | ||||
-rw-r--r-- | layouts/partials/utils/get-summary.html | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/layouts/partials/components/summary-masonry.html b/layouts/partials/components/summary-masonry.html index 2e25854..4027f7a 100644 --- a/layouts/partials/components/summary-masonry.html +++ b/layouts/partials/components/summary-masonry.html @@ -8,7 +8,11 @@ <a href="{{ .Permalink }}" class="hover:text-eureka">{{ .LinkTitle }}</a> </div> <div class=""> - {{- .Summary | plainify -}} + {{ if .Description }} + {{ .Description | plainify | htmlUnescape }} + {{ else if .Summary }} + {{ .Summary | plainify | htmlUnescape }} + {{ end }} </div> </div> <div class="px-6 pb-2"> diff --git a/layouts/partials/utils/get-summary.html b/layouts/partials/utils/get-summary.html index 82a43ed..55eb35c 100644 --- a/layouts/partials/utils/get-summary.html +++ b/layouts/partials/utils/get-summary.html @@ -2,7 +2,11 @@ <a href="{{ .Permalink }}" class="font-bold text-xl hover:text-eureka">{{ .LinkTitle }}</a> </div> <div class="content"> - {{ .Summary | plainify | htmlUnescape }} + {{ if .Description }} + {{ .Description | plainify | htmlUnescape }} + {{ else if .Summary }} + {{ .Summary | plainify | htmlUnescape }} + {{ end }} </div> {{ if eq .Type "docs" }} <div class="px-6 pt-4"> @@ -15,7 +19,11 @@ <a href="{{ .Permalink }}" class="font-semibold hover:text-eureka">{{ .LinkTitle }}</a> </div> <div class=""> - {{- .Summary | plainify | htmlUnescape -}} + {{ if .Description }} + {{ .Description | plainify | htmlUnescape }} + {{ else if .Summary }} + {{ .Summary | plainify | htmlUnescape }} + {{ end }} </div> </div> {{ end }} |