From f88add2fea91f1c3729b5e9ced7426c6dd56ddbd Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Tue, 23 Aug 2022 22:52:37 +0800 Subject: [PATCH] IMPROVEMENT: 1. Change html comments into hugo comments. 2. Polish sever comments to increase readability. --- layouts/partials/head.html | 4 ++- layouts/partials/pic_set.html | 1 - layouts/partials/row.html | 68 +++++++++++++++++++---------------- 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 74111a7..fea1e1f 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,8 +1,10 @@ - +*/}} diff --git a/layouts/partials/pic_set.html b/layouts/partials/pic_set.html index b4d66aa..8043035 100644 --- a/layouts/partials/pic_set.html +++ b/layouts/partials/pic_set.html @@ -1,4 +1,3 @@ - {{ $num_per_row := 3}} {{ $max_width := 80}} {{ if or (eq (len .pic_set) 2) (eq (len .pic_set) 4)}} diff --git a/layouts/partials/row.html b/layouts/partials/row.html index 8ad4584..8c8b274 100644 --- a/layouts/partials/row.html +++ b/layouts/partials/row.html @@ -1,7 +1,8 @@
- + + {{/* time info shown in the left (or above in small screens) */}}
{{ .Date.Format "Jan 2"}}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22) @@ -10,23 +11,23 @@
- + {{/* moment-main-content */}}
- + {{/* top mark */}} {{ if gt .Params.top 0}}
{{ end }} - + {{/* user info */}}
+
- + {{/* Main text content */}}
{{ .Content }}
- - - {{ with .Params.pic }} - Responsive image - {{ end }} - - - {{ $pic_set_filtered := slice}} - {{ with .Params.pic_set }} - {{ range . }} - {{ with . }} - {{ $pic_set_filtered = $pic_set_filtered | append . }} - {{ end }} - {{ end }} - {{ end }} - - {{ with $pic_set_filtered }} - {{ partial "pic_set.html" (dict "pic_set" .) }} - {{ end }} - - + {{/* add-on info 1: pictures */}} + {{/* new pictures API `pictures` (combine single & multiple pictures)*/}} {{ $pictures_set:= slice}} {{ with .Params.pictures }} {{ range . }} @@ -97,23 +80,46 @@ {{ partial "pic_set.html" (dict "pic_set" $pictures_set) }} {{ end }} - + {{/* Probably DEPRECATED in the future: single picture (old version API `pic`)*/}} + {{ with .Params.pic }} + Responsive image + {{ end }} + + {{/* Probably DEPRECATED: multiple pictures (old version API `pic_set`) */}} + {{ $pic_set_filtered := slice}} + {{ with .Params.pic_set }} + {{ range . }} + {{ with . }} + {{ $pic_set_filtered = $pic_set_filtered | append . }} + {{ end }} + {{ end }} + {{ end }} + + {{ with $pic_set_filtered }} + {{ partial "pic_set.html" (dict "pic_set" .) }} + {{ end }} + + + {{/* add-on info 2: hyperlink to other resourse (e.g webpage, Netease music, Bilibili Video) */}} {{ $link_link := .Params.link }} {{ $link_logo := .Params.link_logo }} {{ $link_text := .Params.link_text }} {{ with .Params.link }} - {{ partial "link-block.html" (dict "logo" $link_logo "a" $link_link "word" $link_text "baseurl" - $.Site.BaseURL)}} + {{ partial "link-block.html" (dict "logo" $link_logo "a" $link_link "word" $link_text "baseurl" + $.Site.BaseURL)}} {{ end }} - + {{/* Note info shown below the main content */}}

{{ .Date.Format "15:04" }} {{ .Params.note }}

+
+
+