From 603a9f6d6eae7055433e1cf3bd3a48ae4ff14e37 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Fri, 11 Mar 2022 14:23:52 +0100 Subject: [PATCH 01/15] fix opengraph summary; added twitter meta tags --- layouts/partials/head.html | 1 + layouts/partials/head_meta_opengraph.html | 2 +- layouts/partials/head_meta_twitter.html | 27 +++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/head_meta_twitter.html diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 6562654..dea271e 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -33,5 +33,6 @@ {{- partial "inject/head.html" . -}} {{- partial "head_meta_seo.html" . -}} {{- partial "head_meta_opengraph.html" . -}} + {{- partial "head_meta_twitter.html" . -}} diff --git a/layouts/partials/head_meta_opengraph.html b/layouts/partials/head_meta_opengraph.html index a5c591a..890e48a 100644 --- a/layouts/partials/head_meta_opengraph.html +++ b/layouts/partials/head_meta_opengraph.html @@ -22,7 +22,7 @@ {{ if .Params.description }} {{ else }} - + {{ end }} {{ else }} + + + +{{ if .IsPage }} + + + + {{ if .Params.description }} + + {{ else }} + + {{ end }} +{{ else }} + + {{ if .Site.Params.description }} + + {{ end }} + +{{ end }} From 0587cd280324c52c3f7ac6962f38232f49fb5c35 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Sat, 26 Mar 2022 12:18:03 +0100 Subject: [PATCH 02/15] dont show articles in posts list if section is empty --- layouts/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/index.html b/layouts/index.html index c51291a..9229957 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,7 +2,7 @@ {{/* get all the pages that are regular posts and not pages */}} {{ $postsDir := .Site.Params.Posts | default (slice "posts" "post") }} - {{ $allPostsList := where site.RegularPages "Section" "in" $postsDir }} + {{ $allPostsList := where (where site.RegularPages "Section" "in" $postsDir) "Section" "!=" "" }} {{- partial "showcase.html" . -}} {{- partial "home_post_list.html" (dict "Ctx" . "AllPostsList" $allPostsList) -}} From 2b7198b0326b6d2b5ba105a1a73fa220f16c0f7b Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Sun, 27 Mar 2022 16:57:28 +0200 Subject: [PATCH 03/15] added option to set a page as home; added options to hide title or share button in post --- README.md | 8 ++++++ layouts/_default/single.html | 40 +--------------------------- layouts/index.html | 8 +++++- layouts/partials/single_post.html | 43 +++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 40 deletions(-) create mode 100644 layouts/partials/single_post.html diff --git a/README.md b/README.md index ecf3217..2af25be 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,12 @@ summaryLength = 70 # number of words for article summaries extraContentDirs = [] # other content directories to render similarly to the home page showcaseDir = "showcase" # create a content directory that shows a special showcase section in the home page + # shows a specified single page as a home page, instead of the traditional articles list + # requires setting `homeSinglePage` + # goes well with extraContentDirs + showSinglePageAsHome = false + homeSinglePage = "/home" + # It's best to put these icons in the "static" folder of your site logo = "/logo.svg" favicon = "/favicon.png" # 32x32 @@ -249,6 +255,8 @@ Every post can have various parameters in the frontmatter, here are some that yo - `featured`: boolean, indicate if the post should be shown as featured - `comments`: boolean, if true it enables comments for the current post, if false it disables them (default is true) - `showDate`: boolean, true by default, if false hides the date. Useful for non-article pages where the date isn't important +- `showTitle`: boolean, true by default, if false hides the title. +- `showShare`: boolean, true by default, if false hides the share button. - `norss`: boolean, if set to true the page will be skipped in the rss feed - `nosearch`: boolean, if set to true the page won't show up in searches - `toc`: boolean, if set to true a table of contents will be shown for the article diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2b60730..f20d5db 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,41 +1,3 @@ {{ define "main" }} - {{- partial "inject/content-before.html" . -}} -
-

{{ .Title }}

- {{ if (.Params.showDate | default true) }} -

- - {{- partial "date.html" .Date -}} -

- {{ end }} - {{ if .Params.Image }} - - {{ end }} - {{ if (.Params.toc | default false) }} -
- {{ .TableOfContents }} -
-
- {{ end }} -
{{ .Content }}
-
- {{ if .Params.tags }} - {{ if not .Site.Params.paperCards }}
{{ end }} - - {{ end }} - {{- partial "inject/content-after.html" . -}} - {{- partial "share_on_fediverse.html" . -}} - {{- partial "commento.html" . -}} - {{- partial "cactus_chat.html" . -}} - {{- partial "related_articles.html" . -}} + {{- partial "single_post.html" . -}} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index 9229957..3a5701a 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -4,6 +4,12 @@ {{ $postsDir := .Site.Params.Posts | default (slice "posts" "post") }} {{ $allPostsList := where (where site.RegularPages "Section" "in" $postsDir) "Section" "!=" "" }} {{- partial "showcase.html" . -}} - {{- partial "home_post_list.html" (dict "Ctx" . "AllPostsList" $allPostsList) -}} + {{ if and .Site.Params.showSinglePageAsHome (ne .Site.Params.homeSinglePage "") }} + {{ with .Site.GetPage .Site.Params.homeSinglePage }} + {{- partial "single_post.html" . -}} + {{ end }} + {{ else }} + {{- partial "home_post_list.html" (dict "Ctx" . "AllPostsList" $allPostsList) -}} + {{ end }} {{ end }} diff --git a/layouts/partials/single_post.html b/layouts/partials/single_post.html new file mode 100644 index 0000000..0972df4 --- /dev/null +++ b/layouts/partials/single_post.html @@ -0,0 +1,43 @@ +{{- partial "inject/content-before.html" . -}} +
+ {{ if .Params.showTitle | default true }} +

{{ .Title }}

+ {{ end }} + {{ if (.Params.showDate | default true) }} +

+ + {{- partial "date.html" .Date -}} +

+ {{ end }} + {{ if .Params.Image }} + + {{ end }} + {{ if (.Params.toc | default false) }} +
+ {{ .TableOfContents }} +
+
+ {{ end }} +
{{ .Content }}
+
+{{ if .Params.tags }} + {{ if not .Site.Params.paperCards }}
{{ end }} + +{{ end }} +{{- partial "inject/content-after.html" . -}} +{{ if .Params.showShare | default true }} + {{- partial "share_on_fediverse.html" . -}} +{{ end }} +{{- partial "commento.html" . -}} +{{- partial "cactus_chat.html" . -}} +{{- partial "related_articles.html" . -}} From 210793da66a8f4f08043206ca913ab9a829f102d Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Sun, 27 Mar 2022 18:10:31 +0200 Subject: [PATCH 04/15] added shortcode for image with fixed max-width (imgwwidth) --- layouts/shortcodes/imgwwidth.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 layouts/shortcodes/imgwwidth.html diff --git a/layouts/shortcodes/imgwwidth.html b/layouts/shortcodes/imgwwidth.html new file mode 100644 index 0000000..3ea3d15 --- /dev/null +++ b/layouts/shortcodes/imgwwidth.html @@ -0,0 +1 @@ +{{ .Get "alt" }} From eaa947df25fee5ea40019471d2cadb499f0193df Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Mon, 28 Mar 2022 16:28:17 +0200 Subject: [PATCH 05/15] added option to position the logo at the right of the title --- README.md | 2 ++ assets/scss/style.scss | 9 +++++++++ layouts/partials/header.html | 11 ++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2af25be..5b1d54f 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ summaryLength = 70 # number of words for article summaries svgicon = "/logo.svg" icon512 = "/icon512.png" # 512x512 png image + logoRightOfTitle = false # positions the logo to the right of the title; default: false + showTags = true # show the Tags menu item; default true showRss = true # show the link for the RSS feed; default true diff --git a/assets/scss/style.scss b/assets/scss/style.scss index 4dd0276..1bd6160 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -586,6 +586,15 @@ ul.list { font-weight: normal; font-size: 1.6 * $base_font_size * $title_font_mult; margin: 0; + {{ if site.Params.logoRightOfTitle }} + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: center; + > a { + margin-right: 12px; + } + {{ end }} } img { diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 9fa4514..2ef48b1 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -2,13 +2,18 @@ {{- partial "inject/header-before.html" . -}}
- - - + {{ if not (.Site.Params.logoRightOfTitle | default false) }} + + + + {{ end }} {{- partial "plausible.html" . -}} + {{- partial "umami.html" . -}} {{- partial "inject/body.html" . -}} From 7f1e2726464a1ba0c02e235ccdf49d862ffe2bd1 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Tue, 3 May 2022 12:16:40 +0200 Subject: [PATCH 12/15] added xsl style to feed --- assets/feed_style.xsl | 84 ++++++++++++++++++++++++++++++ layouts/_default/baseof.html | 1 + layouts/index.xml | 1 + layouts/partials/build_assets.html | 10 ++++ layouts/partials/head.html | 2 +- 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 assets/feed_style.xsl create mode 100644 layouts/partials/build_assets.html diff --git a/assets/feed_style.xsl b/assets/feed_style.xsl new file mode 100644 index 0000000..3ed58f5 --- /dev/null +++ b/assets/feed_style.xsl @@ -0,0 +1,84 @@ + + + + + + + <xsl:value-of select="/rss/channel/title"/> RSS Feed + + + + {{ $style := resources.Get "/scss/style.scss" | resources.ExecuteAsTemplate "/scss/style.scss" . | resources.ToCSS (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") | resources.Fingerprint "sha512" }} + + + + +
+

+ + +

+
+

This is a web feed, also known as an RSS feed. Subscribe by copying the URL into your RSS reader.

+
+
+
+ +
+ +
+
+
+
+

📄 Recent Posts

+ +
+

+
Published:
+
+
+
+
+ + +
+
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5d2b506..3b2bc96 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,6 +1,7 @@ {{- partial "head.html" . -}} + {{- partial "build_assets.html" . -}}
{{- partial "header.html" . -}} diff --git a/layouts/index.xml b/layouts/index.xml index 5f52ecc..155c39c 100644 --- a/layouts/index.xml +++ b/layouts/index.xml @@ -11,6 +11,7 @@ {{- $pages = $pages | first $limit -}} {{- end -}} {{- printf "" | safeHTML }} +{{- printf "" | safeHTML -}} {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} diff --git a/layouts/partials/build_assets.html b/layouts/partials/build_assets.html new file mode 100644 index 0000000..216434e --- /dev/null +++ b/layouts/partials/build_assets.html @@ -0,0 +1,10 @@ +{{/* + This partial builds non-standard assets (like xsl files) with the template + engine. It is necessary to do it this way to reduce user friction and + ensure that the file is there. +*/}} +{{ if .IsHome }} + {{ $feed_style_xsl_template := resources.Get "feed_style.xsl" }} + {{ $feed_style_xsl := $feed_style_xsl_template | resources.ExecuteAsTemplate "feed_style.xsl" . }} + {{ $noop := $feed_style_xsl.Permalink }} +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index dea271e..ba5b281 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -29,7 +29,7 @@ {{ end }} {{ $style := resources.Get "/scss/style.scss" | resources.ExecuteAsTemplate "/scss/style.scss" . | resources.ToCSS (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") | resources.Fingerprint "sha512" }} - + {{- partial "inject/head.html" . -}} {{- partial "head_meta_seo.html" . -}} {{- partial "head_meta_opengraph.html" . -}} From 1abb33b4c28d111c3cd72ee0923bbb2ee099b468 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Thu, 19 May 2022 12:52:42 +0200 Subject: [PATCH 13/15] normal color for menu with jumbotron --- assets/scss/style.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/scss/style.scss b/assets/scss/style.scss index 1bd6160..2fb4fa4 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -924,7 +924,7 @@ header.jumbotronContainer { color: var(--default_fg) !important; } #main-nav a, .nerdlink:hover { - color: var(--default_accent) !important; + // color: var(--default_accent) !important; } .nerdlink span { color: var(--default_fg) !important; From c7697a090b294a97e6bda0aa871af15158eeaf5d Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Thu, 19 May 2022 12:53:37 +0200 Subject: [PATCH 14/15] normal color for menu with jumbotron (2) --- assets/scss/style.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/scss/style.scss b/assets/scss/style.scss index 2fb4fa4..b17608e 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -924,7 +924,7 @@ header.jumbotronContainer { color: var(--default_fg) !important; } #main-nav a, .nerdlink:hover { - // color: var(--default_accent) !important; + color: var(--default_fg) !important; } .nerdlink span { color: var(--default_fg) !important; From bedcf7a2126fab67b9647005b0ed977844cc1085 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Fri, 20 May 2022 18:54:29 +0200 Subject: [PATCH 15/15] jumbotron use h2 and h3 instead of h1 and h2 --- assets/scss/style.scss | 6 +++--- layouts/partials/jumbotron.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/scss/style.scss b/assets/scss/style.scss index b17608e..95fe342 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -1084,13 +1084,13 @@ header.jumbotronContainer { max-width: 100vw; min-width: 200px; } - h1 { + h2 { font-weight: 300; &.huge { font-size: 4 * $base_font_size * $title_font_mult; } } - h1, h2 { + h2, h3 { margin: 12px; } ul { @@ -1121,7 +1121,7 @@ header.jumbotronContainer { h1.huge { font-size: 3 * $base_font_size * $title_font_mult !important; } - h1, h2 { + h2, h3 { margin: 6px; } } diff --git a/layouts/partials/jumbotron.html b/layouts/partials/jumbotron.html index bcbd611..36a9ead 100644 --- a/layouts/partials/jumbotron.html +++ b/layouts/partials/jumbotron.html @@ -27,12 +27,12 @@ {{ end }}
-

{{ .Site.Data.jumbotron.title }}

-

{{ .Site.Data.jumbotron.subtitle }}

+ ">{{ .Site.Data.jumbotron.title }} +

{{ .Site.Data.jumbotron.subtitle }}

{{ if .Site.Data.jumbotron.backgroundVideo }}