From 5265af0b3bac005de6d7cd9c5dfb97fc60ff09f5 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Fri, 11 Sep 2020 23:00:19 +0200 Subject: reafctor(head): rewrite description.html function --- layouts/partials/data/description.html | 23 +++++++++++----------- layouts/partials/head/head.html | 9 ++++++--- layouts/partials/head/opengraph/provider/base.html | 7 +++++-- .../partials/head/opengraph/provider/twitter.html | 7 +++++-- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/layouts/partials/data/description.html b/layouts/partials/data/description.html index 5531ab5..fa9f785 100644 --- a/layouts/partials/data/description.html +++ b/layouts/partials/data/description.html @@ -1,11 +1,12 @@ -{{- with .Description -}} - {{- . -}} -{{- else -}} - {{- if .IsPage -}} - {{- .Summary -}} - {{- else -}} - {{- with .Site.Params.subtitle -}} - {{- . -}} - {{- end -}} - {{- end -}} -{{- end -}} \ No newline at end of file + +{{ $description := .Site.Params.subtitle }} + +{{ if .Description }} + + {{ $description = .Description }} +{{ else if .IsPage }} + + {{ $description = .Summary }} +{{ end }} + +{{ return ($description | plainify)}} \ No newline at end of file diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html index eb9cc0f..5ab35dd 100644 --- a/layouts/partials/head/head.html +++ b/layouts/partials/head/head.html @@ -1,10 +1,13 @@ - - + + + {{- $description := partial "data/description" . -}} + {{- $title := partial "data/title" . -}} - {{ $title }} + {{ $title }} + {{- partial "head/style.html" . -}} diff --git a/layouts/partials/head/opengraph/provider/base.html b/layouts/partials/head/opengraph/provider/base.html index beac56c..ea7f084 100644 --- a/layouts/partials/head/opengraph/provider/base.html +++ b/layouts/partials/head/opengraph/provider/base.html @@ -1,5 +1,8 @@ - - +{{- $title := partial "data/title" . -}} +{{- $description := partial "data/description" . -}} + + +