From e120f3ae18602baad72cdc1b1ff9fceb9f991e52 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Mon, 24 Aug 2020 19:27:51 +0200 Subject: [PATCH] refactor(article): split article.html into header, content and footer partials --- layouts/partials/article/article.html | 74 +------------------ .../partials/article/components/content.html | 3 + .../partials/article/components/footer.html | 16 ++++ .../partials/article/components/header.html | 52 +++++++++++++ 4 files changed, 74 insertions(+), 71 deletions(-) create mode 100644 layouts/partials/article/components/content.html create mode 100644 layouts/partials/article/components/footer.html create mode 100644 layouts/partials/article/components/header.html diff --git a/layouts/partials/article/article.html b/layouts/partials/article/article.html index 6748188..c7c9064 100644 --- a/layouts/partials/article/article.html +++ b/layouts/partials/article/article.html @@ -1,75 +1,7 @@
-
- {{ if .Params.image }} - {{- $image := partial "helper/image" . -}} + {{ partial "article/components/header" . }} - {{- $tablet := $image.Resize "1024x" -}} - {{- $desktop := $image.Resize "2000x" -}} + {{ partial "article/components/content" . }} - {{- $20x := $image.Fill "20x20 smart" -}} - {{- .Scratch.Set "20x" $20x -}} - -
- Featured image of post {{ .Title }} -
- {{ end }} - -
- {{ with $category := .Params.categories }} - - {{ end }} - -

- - {{- .Title -}} - -

- - {{ with .Params.description }} -

- {{ . }} -

- {{ end }} - -
- {{ (resources.Get "icons/clock.svg").Content | safeHTML }} - -
-
-
- -
- {{ .Content }} -
- -
- {{ with $tags := .Params.Tags }} - - {{ end }} - - {{ if .Site.Params.postLicense }} -
- {{ (resources.Get "icons/copyright.svg").Content | safeHTML }} - {{ .Site.Params.postLicense }} -
- {{ end }} -
+ {{ partial "article/components/footer" . }}
\ No newline at end of file diff --git a/layouts/partials/article/components/content.html b/layouts/partials/article/components/content.html new file mode 100644 index 0000000..fc0f8f6 --- /dev/null +++ b/layouts/partials/article/components/content.html @@ -0,0 +1,3 @@ +
+ {{ .Content }} +
diff --git a/layouts/partials/article/components/footer.html b/layouts/partials/article/components/footer.html new file mode 100644 index 0000000..223710a --- /dev/null +++ b/layouts/partials/article/components/footer.html @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/layouts/partials/article/components/header.html b/layouts/partials/article/components/header.html new file mode 100644 index 0000000..df9e374 --- /dev/null +++ b/layouts/partials/article/components/header.html @@ -0,0 +1,52 @@ +
+ {{ if .Params.image }} + {{- $image := partial "helper/image" . -}} + + {{- $tablet := $image.Resize "1024x" -}} + {{- $desktop := $image.Resize "2000x" -}} + + {{- $20x := $image.Fill "20x20 smart" -}} + {{- .Scratch.Set "20x" $20x -}} + +
+ Featured image of post {{ .Title }} +
+ {{ end }} + +
+ {{ with $category := .Params.categories }} + + {{ end }} + +

+ + {{- .Title -}} + +

+ + {{ with .Params.description }} +

+ {{ . }} +

+ {{ end }} + + +
+
\ No newline at end of file