From 640a72444eea510044d1972eacaf6674a79a1ab7 Mon Sep 17 00:00:00 2001 From: Andrew Reid Date: Sat, 23 Apr 2022 09:59:56 +0930 Subject: [PATCH 1/7] Optionally display post images as a gallery --- README.md | 8 ++++++++ layouts/posts/single.html | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d7764bf6..1e596f51 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,14 @@ weight = 4 Projects section will not be shown if no data file is detected. See [Projects list](#projects-list) below. +### Posts + +You can display the images in the page bundle as a gallery at the top of your post: + +```yaml +show_gallery: true +``` + ### Projects list Create your projects data file `data/projects.yaml|toml|json`. Hugo support yaml, toml and json formats. diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 5df437a0..9fa2161f 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -58,16 +58,17 @@

{{ end }} - - {{ with .Resources.ByType "image" }} -
- {{ range $index, $value := . }} - - - - {{ end }} -
- {{ end }} + {{ if isset .Params.show_gallery }} + {{ with .Resources.ByType "image" }} +
+ {{ range $index, $value := . }} + + + + {{ end }} +
+ {{ end }} + {{ end }} {{ if .Site.Params.tocInline }}
{{ .TableOfContents }} From 27b42023a9040fee676de60ba2c69e0333a65fd5 Mon Sep 17 00:00:00 2001 From: Andrew Reid Date: Sat, 23 Apr 2022 10:07:13 +0930 Subject: [PATCH 2/7] Fixed syntax error in show_gallery --- layouts/posts/single.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 9fa2161f..acc30380 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -58,7 +58,7 @@

{{ end }}

- {{ if isset .Params.show_gallery }} + {{ if isset .Params "show_gallery" }} {{ with .Resources.ByType "image" }}
{{ range $index, $value := . }} From c6b196935137a7618c22c96fc5a7e5a7b1fde0ff Mon Sep 17 00:00:00 2001 From: Andrew Reid Date: Sat, 23 Apr 2022 10:59:22 +0930 Subject: [PATCH 3/7] Changes for personal preferences on own website --- layouts/index.html | 12 +++++++----- layouts/partials/footer.html | 7 ------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index 10c5e28f..de694e59 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -8,9 +8,8 @@ {{ $length := (len .Site.Params.social) }} {{ range $index, $elem := .Site.Params.social}} {{ if eq $elem.name "email" }} - - - + send me an + e-mail. {{ else if eq $elem.name "rss" }} @@ -19,6 +18,9 @@ + {{ else if eq $elem.name "twitter" }} + + Twitter {{ else }} @@ -27,9 +29,9 @@ {{ if (lt (add $index 2) $length) }} {{- print " , " -}} {{ else if (lt (add $index 1) $length) }} - {{- print " and " -}} + {{- print " or " -}} {{ else }} - {{- print "." -}} + {{/* {{- print "." -}} */}} {{ end }} {{ end }}

diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 31eb4aa8..6dcb80cd 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -3,12 +3,5 @@ Copyright © {{ now.Format "2006" }} {{ if .Site.Copyright }} {{ print .Site.Copyright | markdownify }} {{ else }} {{ print .Site.Title }} {{ end }}
From 298ddc693403629fddaaacacb81348dc873101f1 Mon Sep 17 00:00:00 2001 From: Andrew Reid Date: Sat, 28 May 2022 12:48:53 +0930 Subject: [PATCH 4/7] Optionally hide posts from front page list. Remove cactus chat CSS/JS --- layouts/index.html | 11 +++++++---- layouts/partials/head.html | 2 -- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index de694e59..c1d55f3d 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -63,10 +63,13 @@ {{ if $showAllPostsOnHomePage }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 90ef9277..82ea9c32 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -3,8 +3,6 @@ - - {{ if .IsPage }} {{ .Title }} | {{ end }}{{ .Site.Title }} From 157ded334fd4e195119ac224e8d50af108dec8ac Mon Sep 17 00:00:00 2001 From: Andrew Reid Date: Sat, 28 May 2022 13:02:43 +0930 Subject: [PATCH 5/7] Don't display posts marked "hidden" in the list --- layouts/_default/list.html | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e8c3e313..05127840 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -13,14 +13,17 @@ {{ $.Scratch.Set "year" $pageYear }}

{{ $pageYear }}

{{ end }} -
  • -
    - -
    - - {{ if .Title }} {{ .Title }} {{ else }} Untitled {{ end }} - -
  • + {{ if isset .Params "hidden" }} + {{ else }} +
  • +
    + +
    + + {{ if .Title }} {{ .Title }} {{ else }} Untitled {{ end }} + +
  • + {{ end }} {{ end }} {{ if eq .Site.Params.showAllPostsArchive false }} From 989adf37ba457ca94d5ad71b5936380489b6c86f Mon Sep 17 00:00:00 2001 From: Andrew Reid Date: Sat, 28 May 2022 23:10:46 +0930 Subject: [PATCH 6/7] Added media property to stylesheet link tag --- layouts/partials/head.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 82ea9c32..4b36dd83 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -21,7 +21,7 @@ {{- $options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") -}} {{- $styles := resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "scss/style.scss" . | resources.ToCSS $options | resources.Fingerprint "sha512" }} - + {{ range .Site.Params.css }} {{ end }} From 55aec54d368fb67a8793b4a784dccef582ed00ff Mon Sep 17 00:00:00 2001 From: Andrew Reid Date: Sun, 29 May 2022 00:23:11 +0930 Subject: [PATCH 7/7] Integrity begone --- layouts/partials/head.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 4b36dd83..38d05e4e 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -21,7 +21,7 @@ {{- $options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") -}} {{- $styles := resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "scss/style.scss" . | resources.ToCSS $options | resources.Fingerprint "sha512" }} - + {{ range .Site.Params.css }} {{ end }}