From dc6812c0aeb8fe5add35d9f4b8a1928ff76ee410 Mon Sep 17 00:00:00 2001 From: kartnico Date: Wed, 27 Mar 2024 17:58:37 +0100 Subject: [PATCH 1/7] fix path to thumbnail images incorrect on second and higher page Signed-off-by: kartnico --- layouts/partials/figure.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/figure.html b/layouts/partials/figure.html index e5b7afc0..28203afb 100644 --- a/layouts/partials/figure.html +++ b/layouts/partials/figure.html @@ -54,10 +54,10 @@ class="{{ $classes }} image_processed" width="{{ .Width }}" height="{{ .Height }}" - src="{{ .RelPermalink }}" + src="{{ .RelPermalink | absURL }}" {{ else }} class="{{ $classes }} image_unprocessed" - src="{{ $fileWeb }}" + src="{{ $fileWeb | absURL }}" {{ end }} {{ with $cap }} title="{{ safeHTML $cap }}" From ba40802b873596d52dd41e4276ab4e6c2f80e3b5 Mon Sep 17 00:00:00 2001 From: barefootstache Date: Mon, 9 Sep 2024 15:56:35 +0200 Subject: [PATCH 2/7] feat: initiate `blogDir` setting Signed-off-by: barefootstache --- exampleSite/config/_default/params.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 65574536..bc59708e 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -102,6 +102,9 @@ languageMenuName = "🌐" # Enable or disable comments globally. Default to true. # comments = false +# Activate meta ld+json for blog +blogDir = "post" + # Enable or disable Utterances (https://github.com/utterance/utterances) Github Issue-Based Commenting # utterances = true # Run the utterances script in the single.html layout to load https://utteranc.es comments # utterancesRepo = "GHUsername/Repository.Name" # Utterances is enabled when this param is set From 779c7e1824ca7020c8e5346d0e6e944a4431114b Mon Sep 17 00:00:00 2001 From: barefootstache Date: Mon, 9 Sep 2024 15:59:54 +0200 Subject: [PATCH 3/7] feat: extend with keywords and categories Signed-off-by: barefootstache --- layouts/partials/opengraph.html | 40 ++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html index cfc2aca2..b535d1ac 100644 --- a/layouts/partials/opengraph.html +++ b/layouts/partials/opengraph.html @@ -59,20 +59,46 @@ -{{- $keywords := "" }} +{{- $mergedKeywords := slice }} {{- with $s.keywords }} - {{- $keywords = delimit $s.keywords "," }} + {{- range . }} + {{- $mergedKeywords = $mergedKeywords | append . }} + {{- end }} {{- end }} {{- with $p.keywords }} - {{- $keywords = delimit . "," }} + {{- range . }} + {{- $mergedKeywords = $mergedKeywords | append . }} + {{- end }} +{{- end }} +{{- with $s.tags }} + {{- range . }} + {{- $mergedKeywords = $mergedKeywords | append . }} + {{- end }} {{- end }} -{{- with $keywords }} - +{{- with $p.tags }} + {{- range . }} + {{- $mergedKeywords = $mergedKeywords | append . }} + {{- end }} +{{- end }} +{{- $mergedKeywordsString := delimit $mergedKeywords "," }} +{{- with $mergedKeywordsString }} + {{- end }} {{- if eq .Section $s.blogDir -}} {{- $date := ( .Date.Format "2006-02-01") -}} {{- $date := (time .Date) }} {{- $lastMod := (time .Lastmod) }} + {{- $categories := slice }} + {{- with $s.categories }} + {{- range . }} + {{- $categories = $categories | append . }} + {{- end }} + {{- end }} + {{- with $p.categories }} + {{- range . }} + {{- $categories = $categories | append . }} + {{- end }} + {{- end }} + -+ ++ - ``` diff --git a/exampleSite/.gitignore b/exampleSite/.gitignore index 132a0908..e4b8c67d 100644 --- a/exampleSite/.gitignore +++ b/exampleSite/.gitignore @@ -1,2 +1,3 @@ public/ -resources/ \ No newline at end of file +resources/ +.hugo_build.lock \ No newline at end of file diff --git a/exampleSite/content/post/math-typesetting.md b/exampleSite/content/post/math-typesetting.md index 48fdc79f..242a3721 100644 --- a/exampleSite/content/post/math-typesetting.md +++ b/exampleSite/content/post/math-typesetting.md @@ -11,9 +11,8 @@ Mathematical notation in a Hugo project can be enabled by using third party Java In this example we will be using [KaTeX](https://katex.org/) -- Create a partial under `/layouts/partials/math.html` -- Within this partial reference the [Auto-render Extension](https://katex.org/docs/autorender.html) or host these scripts locally. -- Include the partial in your templates like so: +- Create a partial under `/layouts/partials/hooks/head-end.html` +- Add these lines to the newly created partial: ```bash {{ if or .Params.math .Site.Params.math }} @@ -21,17 +20,17 @@ In this example we will be using [KaTeX](https://katex.org/) {{ end }} ``` -- To enable KaTex globally set the parameter `math` to `true` in a project's configuration -- To enable KaTex on a per page basis include the parameter `math: true` in content files +- To enable KaTeX globally set the parameter `math` to `true` in a project's configuration +- To enable KaTeX on a per page basis include the parameter `math: true` in content files **Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html) {{< math.inline >}} {{ if or .Page.Params.math .Site.Params.math }} - - - + + + {{ end }} {{}} diff --git a/exampleSite/layouts/.gitkeep b/exampleSite/layouts/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/exampleSite/layouts/partials/hooks/head-end.html b/exampleSite/layouts/partials/hooks/head-end.html new file mode 100644 index 00000000..6af03480 --- /dev/null +++ b/exampleSite/layouts/partials/hooks/head-end.html @@ -0,0 +1,3 @@ +{{ if or .Params.math .Site.Params.math }} +{{ partial "math.html" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/math.html b/layouts/partials/math.html index 999766e8..427d25f8 100644 --- a/layouts/partials/math.html +++ b/layouts/partials/math.html @@ -1,3 +1,3 @@ - - - \ No newline at end of file + + + \ No newline at end of file From f90db945d00adc24e059c4b8a01367997eed53ec Mon Sep 17 00:00:00 2001 From: Robert Terakedis <26422950+rterakedis@users.noreply.github.com> Date: Sun, 22 Sep 2024 00:49:28 -0400 Subject: [PATCH 6/7] Adding Giscus Support Adding giscus.app support (similar to utterances) Signed-off-by: Robert Terakedis <26422950+rterakedis@users.noreply.github.com> --- README.md | 11 +++++++++++ exampleSite/config/_default/params.toml | 12 ++++++++++++ layouts/partials/comments.html | 3 +++ layouts/partials/giscus.html | 18 ++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 layouts/partials/giscus.html diff --git a/README.md b/README.md index a0c7926a..8b06c2bc 100644 --- a/README.md +++ b/README.md @@ -825,7 +825,18 @@ If you wish use [Utterances](https://github.com/utterance/utterances) comments o Utterances is loaded in the `comments.html` partial by referring to the `utterances.html` partial. Since `single.html` layout loads comments if comments are enabled, you must ensure *both* the `comments` and `utterances` parameters are configured. +#### Giscus Commenting Support +If you wish use [giscus](https://giscus.app/) comments on your site, you'll need to perform the following: + + * Ensure your repository is [public](https://docs.github.com/en/github/administering-a-repository/managing-repository-settings/setting-repository-visibility#making-a-repository-public), otherwise visitors will not be able to view the discussion. + * The [giscus app](https://github.com/apps/giscus) is installed, otherwise visitors will not be able to comment and react. + * The Discussions feature is turned on by [enabling it for your repository](https://docs.github.com/en/github/administering-a-repository/managing-repository-settings/enabling-or-disabling-github-discussions-for-a-repository). + * Comment out the line for `disqusShortname = ""` in the `/config/_default/config.toml` file. + * Set `comments = true` in the `/config/_default/params.toml` file. + * Configure the giscus parameters in the `/config/_default/params.toml` file. + +Giscus is loaded in the `comments.html` partial by referring to the `giscus.html` partial. Since `single.html` layout loads comments if comments are enabled, you must ensure *both* the `comments` and `giscus` parameters are configured. ### Math notation diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 6831fa2f..8976eeb3 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -109,6 +109,18 @@ languageMenuName = "🌐" # utterancesTheme = "github-light" # Default: github-dark # utterancesIssueTerm = "pathname" # Default: pathname +# Enable or disable Giscus comments globally. Default to false. +# giscus = true +# giscusRepo = "GHUsername/Repository.Name" # Giscus is enabled when this param is set +# giscusRepoId = "RepositoryID" # Required for Giscus to work +# giscusCategory = "Blog" +# giscusCategoryId = "CategoryID" # Required for Giscus to work +# giscusMapping = "pathname" # Default: pathname +# giscusReactionsEnabled = "1" # Default: 1 = true +# giscusTheme = "dark_protanopia" # Default: dark_dimmed +# giscusLang = "en" # Default: en + + # Maximum number of recent posts. (default: 8) # numberOfRecentPosts = 8 diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 311788ff..5efcf691 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -5,5 +5,8 @@ {{ if .Site.Params.utterances }} {{ template "partials/utterances.html" . }} {{ end }} + {{ if .Site.Params.giscus }} + {{ template "partials/giscus.html" . }} + {{ end }} diff --git a/layouts/partials/giscus.html b/layouts/partials/giscus.html new file mode 100644 index 00000000..88089a67 --- /dev/null +++ b/layouts/partials/giscus.html @@ -0,0 +1,18 @@ +{{ if .Site.Params.giscus }} + + {{ end }} \ No newline at end of file From 03498e3d9ac1a9ab0c3e5d2ecc3e66b4bee32509 Mon Sep 17 00:00:00 2001 From: Chip Zoller Date: Sun, 22 Sep 2024 08:07:04 -0400 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b06c2bc..cff44c4c 100644 --- a/README.md +++ b/README.md @@ -827,7 +827,7 @@ Utterances is loaded in the `comments.html` partial by referring to the `utteran #### Giscus Commenting Support -If you wish use [giscus](https://giscus.app/) comments on your site, you'll need to perform the following: +If you wish to use [giscus](https://giscus.app/) comments on your site, you'll need to perform the following: * Ensure your repository is [public](https://docs.github.com/en/github/administering-a-repository/managing-repository-settings/setting-repository-visibility#making-a-repository-public), otherwise visitors will not be able to view the discussion. * The [giscus app](https://github.com/apps/giscus) is installed, otherwise visitors will not be able to comment and react.