From 3826f9ca610f3041a484f93947f839c653057b62 Mon Sep 17 00:00:00 2001 From: Nelson/Roberto Date: Mon, 11 May 2020 22:42:24 +0000 Subject: - Banner image can now be set in post params or pulled from the bundle. - Implemented tags --- exampleSite/content/blog/post.10/banner.jpg | Bin 0 -> 20737 bytes exampleSite/content/blog/post.10/index.md | 4 +--- exampleSite/content/blog/post.10/pic04.jpg | Bin 20737 -> 0 bytes exampleSite/content/blog/post.3.md | 2 +- exampleSite/content/blog/post.4.md | 2 +- layouts/_default/list.html | 4 +++- layouts/_default/single.html | 5 +++-- layouts/partials/bannerURL.html | 7 +++++++ layouts/partials/tags.html | 15 +++++++++++++++ 9 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 exampleSite/content/blog/post.10/banner.jpg delete mode 100644 exampleSite/content/blog/post.10/pic04.jpg create mode 100644 layouts/partials/bannerURL.html create mode 100644 layouts/partials/tags.html diff --git a/exampleSite/content/blog/post.10/banner.jpg b/exampleSite/content/blog/post.10/banner.jpg new file mode 100644 index 0000000..b0206cb Binary files /dev/null and b/exampleSite/content/blog/post.10/banner.jpg differ diff --git a/exampleSite/content/blog/post.10/index.md b/exampleSite/content/blog/post.10/index.md index 55fa2eb..3a9ab86 100644 --- a/exampleSite/content/blog/post.10/index.md +++ b/exampleSite/content/blog/post.10/index.md @@ -4,9 +4,7 @@ slug = 'page-bundle-example' date = "2019-08-15T00:00:00" description = 'Donec eget ex magna. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque venenatis dolor imperdiet dolor mattis sagittis magna etiam.' disqus_identifier = '9' -[[resources]] - name = "header" - src = "pic04.jpg" +tags = ["tag1","tag2"] +++ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sit amet dui nec dui commodo auctor non eu mauris. Duis varius finibus vestibulum. Praesent aliquam, erat sed dictum feugiat, velit erat iaculis elit, eget iaculis ex libero ac sapien. Sed maximus ut lectus et varius. Nullam posuere velit vitae est consectetur porttitor. Vestibulum tempor felis ante, nec volutpat risus vestibulum ac. Mauris at finibus felis, eu placerat arcu. Sed nec semper nunc. Proin eget mollis felis. Donec fermentum lectus non metus elementum, dignissim ornare felis congue. In rhoncus vehicula nibh, ac imperdiet dolor tincidunt sit amet. diff --git a/exampleSite/content/blog/post.10/pic04.jpg b/exampleSite/content/blog/post.10/pic04.jpg deleted file mode 100644 index b0206cb..0000000 Binary files a/exampleSite/content/blog/post.10/pic04.jpg and /dev/null differ diff --git a/exampleSite/content/blog/post.3.md b/exampleSite/content/blog/post.3.md index f0c5012..e3be375 100644 --- a/exampleSite/content/blog/post.3.md +++ b/exampleSite/content/blog/post.3.md @@ -1,7 +1,7 @@ +++ title = 'Augue lorem primis vestibulum' slug = 'post3' -image = 'images/pic07.jpg' +image = 'images/pic02.jpg' date = "2019-04-07T00:00:00" description = 'Donec eget ex magna. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque venenatis dolor imperdiet dolor mattis sagittis magna etiam.' disableComments = true diff --git a/exampleSite/content/blog/post.4.md b/exampleSite/content/blog/post.4.md index 9101391..d559e48 100644 --- a/exampleSite/content/blog/post.4.md +++ b/exampleSite/content/blog/post.4.md @@ -1,7 +1,7 @@ +++ title = 'Odio magna sed consectetur' slug = 'post4' -image = 'images/pic06.jpg' +image = 'images/pic03.jpg' date = "2019-04-11T00:00:00" description = 'Donec eget ex magna. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque venenatis dolor imperdiet dolor mattis sagittis magna etiam.' disableComments = true diff --git a/layouts/_default/list.html b/layouts/_default/list.html index ff096a0..ecee70f 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -7,7 +7,9 @@ {{ range .Pages }}
- + {{ with partial "bannerURL" . }} + + {{ end }}

{{ .Title }}

{{ with .Date }}

{{ .Format "Jan 2, 2006" }}

{{ end }} {{ with .Description }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0b95cb4..d8119a1 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,10 +4,11 @@

{{ .Date.Format "Jan 2, 2006" }}

- {{ with .Params.image }} - + {{ with partial "bannerURL" . }} + {{ end }} {{ .Content }} + {{ partial "tags" . }}
{{ if .Site.DisqusShortname }}
diff --git a/layouts/partials/bannerURL.html b/layouts/partials/bannerURL.html new file mode 100644 index 0000000..4f2abfa --- /dev/null +++ b/layouts/partials/bannerURL.html @@ -0,0 +1,7 @@ +{{ $bannerURL := "" }} +{{ if .Params.image }} + {{ $bannerURL = (.Params.image | relURL) }} +{{ else if .Resources.GetMatch "banner.jpg" }} + {{ $bannerURL = (.Resources.GetMatch "banner.jpg").Permalink }} +{{ end }} +{{ return $bannerURL }} \ No newline at end of file diff --git a/layouts/partials/tags.html b/layouts/partials/tags.html new file mode 100644 index 0000000..abc2c4d --- /dev/null +++ b/layouts/partials/tags.html @@ -0,0 +1,15 @@ +{{/* Code thanks to Jake Wiesler, https://www.jakewiesler.com/blog/hugo-taxonomies/ */}} +{{ $taxonomy := "tags" }} +{{ with .Param $taxonomy }} +
+

{{ $taxonomy }}

+
    + {{ range $index, $tag := . }} + {{ with $.Site.GetPage (printf "/%s/%s" $taxonomy $tag) -}} +
  • + {{ $tag | urlize }} +
  • + {{- end -}} + {{- end -}} +
+{{ end }} \ No newline at end of file -- cgit v1.2.3