From b8de167466065ef983e689ed0b97ee14a1646ac1 Mon Sep 17 00:00:00 2001
From: Caio Lente <7017340+clente@users.noreply.github.com>
Date: Fri, 3 Nov 2023 00:17:13 -0300
Subject: Typo
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3b73cd4..2d3be2e 100644
--- a/README.md
+++ b/README.md
@@ -107,7 +107,7 @@ already implemented:
matter](https://gohugo.io/content-management/front-matter/). You can also add
`render: false` to your [build
options](https://gohugo.io/content-management/build-options/#readout) to avoid
- rendering a blank post.
+ rendering blank posts.
- Skip link: a "skip to main content" link that is temporarily invisible, but
can be focused by people who need a keyboard to navigate the web (see [PR
#5](https://github.com/clente/hugo-bearcub/pull/5) by
--
cgit v1.2.3
From bda54f97d8850884a17752951e5971ce2f8d58f1 Mon Sep 17 00:00:00 2001
From: Caio Lente <7017340+clente@users.noreply.github.com>
Date: Thu, 4 Jan 2024 17:03:02 -0300
Subject: Update social card logic
---
README.md | 2 +-
exampleSite/config.toml | 2 +-
layouts/_default/single.html | 2 +-
layouts/partials/social_card.html | 44 ++++++++++++++++++++++++++++++++-------
4 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index 2d3be2e..d5b77dd 100644
--- a/README.md
+++ b/README.md
@@ -214,7 +214,7 @@ enableRobotsTXT = true
# Social media. Delete any item you aren't using to make sure it won't show up
# in your website's metadata.
- [social]
+ [params.social]
email = "me@example.com" # Added to the footer so readers can reply to posts
twitter = "example" # Twitter handle (without '@')
facebook_admin = "0000000000" # Facebook Page Admin ID
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index d5eff2b..9e1f9c9 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -76,7 +76,7 @@ enableRobotsTXT = true
# Social media. Delete any item you aren't using to make sure it won't show up
# in your website's metadata.
- [social]
+ [params.social]
email = "me@example.com" # Added to the footer so readers can reply to posts
twitter = "example" # Twitter handle (without '@')
facebook_admin = "0000000000" # Facebook Page Admin ID
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 89b58d5..fb30bdf 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -16,7 +16,7 @@
#{{ .LinkTitle }}
{{ end }}
-{{ with .Site.Social.email }}
+{{ with .Site.Params.social.email }}
{{ i18n "email-reply" }} ↪
diff --git a/layouts/partials/social_card.html b/layouts/partials/social_card.html
index 68bb4ca..c55d56a 100644
--- a/layouts/partials/social_card.html
+++ b/layouts/partials/social_card.html
@@ -29,7 +29,7 @@
{{ $card := $card.Resize "900x webp q100" }}
-
+
@@ -63,22 +63,52 @@
{{ end }}{{ end }}
{{- end }}
+{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}}
+{{- $facebookAdmin := "" }}
+{{- with site.Params.social }}
+ {{- if reflect.IsMap . }}
+ {{- $facebookAdmin = .facebook_admin }}
+ {{- end }}
+{{- else }}
+ {{- with site.Social.facebook_admin }}
+ {{- $facebookAdmin = . }}
+ {{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }}
+ {{- end }}
+{{- end }}
+
{{- /* Facebook Page Admin ID for Domain Insights */}}
-{{- with .Site.Social.facebook_admin }} {{ end }}
+{{ with $facebookAdmin }} {{ end }}
-
-{{ with .Site.Social.twitter -}}
-
-{{ end -}}
+
+{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
+{{- $twitterSite := "" }}
+{{- with site.Params.social }}
+ {{- if reflect.IsMap . }}
+ {{- $twitterSite = .twitter }}
+ {{- end }}
+{{- else }}
+ {{- with site.Social.twitter }}
+ {{- $twitterSite = . }}
+ {{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }}
+ {{- end }}
+{{- end }}
+
+{{- with $twitterSite }}
+ {{- $content := . }}
+ {{- if not (strings.HasPrefix . "@") }}
+ {{- $content = printf "@%v" $twitterSite }}
+ {{- end }}
+
+{{- end }}
-
+
--
cgit v1.2.3
From 0b1713a7d964d941052e55bfefab6bb68389c409 Mon Sep 17 00:00:00 2001
From: Caio Lente <7017340+clente@users.noreply.github.com>
Date: Thu, 4 Jan 2024 17:31:55 -0300
Subject: Update RSS template
---
layouts/_default/rss.xml | 84 ++++++++++++++++++++++++++++++++----------------
1 file changed, 57 insertions(+), 27 deletions(-)
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index c55e7e4..70d1193 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -1,42 +1,72 @@
-{{- $pctx := . -}}
-{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
-{{- $pages := slice -}}
-{{- if $.IsHome -}}
-{{- $pages = where $pctx.AllPages "Kind" "page" -}}
-{{ else if $.IsSection }}
-{{- $pages = $pctx.RegularPages -}}
-{{- else -}}
-{{- $pages = $pctx.Pages -}}
-{{- end -}}
-{{- $limit := .Site.Config.Services.RSS.Limit -}}
-{{- if ge $limit 1 -}}
-{{- $pages = $pages | first $limit -}}
-{{- end -}}
+{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
+{{- $authorEmail := "" }}
+{{- with site.Params.author }}
+ {{- if reflect.IsMap . }}
+ {{- with .email }}
+ {{- $authorEmail = . }}
+ {{- end }}
+ {{- end }}
+{{- else }}
+ {{- with site.Author.email }}
+ {{- $authorEmail = . }}
+ {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
+ {{- end }}
+{{- end }}
+
+{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
+{{- $authorName := "" }}
+{{- with site.Params.author }}
+ {{- if reflect.IsMap . }}
+ {{- with .name }}
+ {{- $authorName = . }}
+ {{- end }}
+ {{- else }}
+ {{- $authorName = . }}
+ {{- end }}
+{{- else }}
+ {{- with site.Author.name }}
+ {{- $authorName = . }}
+ {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
+ {{- end }}
+{{- end }}
+
+{{- $pctx := . }}
+{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
+{{- $pages := slice }}
+{{- if or $.IsHome $.IsSection }}
+{{- $pages = $pctx.RegularPages }}
+{{- else }}
+{{- $pages = $pctx.Pages }}
+{{- end }}
+{{- $limit := .Site.Config.Services.RSS.Limit }}
+{{- if ge $limit 1 }}
+{{- $pages = $pages | first $limit }}
+{{- end }}
{{- printf "" | safeHTML }}
- {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}
+ {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}
{{ .Permalink }}
- Recent content {{ if not .IsHome }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}
+ Recent content {{ if not .IsHome }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}
Hugo -- gohugo.io
- {{ site.Language.LanguageCode }} {{ with .Site.Author.email }}
- {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}} {{end}}{{ with .Site.Author.email }}
- {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}} {{end}}{{ with .Site.Copyright }}
- {{.}} {{end}}{{ if not .Date.IsZero }}
+ {{ site.Language.LanguageCode }} {{ with $authorEmail }}
+ {{.}}{{ with $authorName }} ({{ . }}){{ end }} {{ end }}{{ with $authorEmail }}
+ {{ . }}{{ with $authorName }} ({{ . }}){{ end }} {{ end }}{{ with .Site.Copyright }}
+ {{ . }} {{ end }}{{ if not .Date.IsZero }}
{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{ end }}
- {{- with .OutputFormats.Get "RSS" -}}
+ {{- with .OutputFormats.Get "RSS" }}
{{ printf " " .Permalink .MediaType | safeHTML }}
- {{- end -}}
- {{ range $pages }}
+ {{- end }}
+ {{- range $pages }}
-
{{ .Title }}
{{ .Permalink }}
{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
- {{ with .Params.author }}{{.}} {{ end }}
+ {{- with $authorEmail }}{{ . }}{{ with $authorName }} ({{ . }}){{ end }} {{ end }}
{{ .Permalink }}
- {{ .Summary | plainify }}
+ {{ .Summary | transform.XMLEscape | safeHTML }}
{{ `` | safeHTML }}
- {{ end }}
+ {{- end }}
-
\ No newline at end of file
+
--
cgit v1.2.3
From bd5d81f18c0fdb9be3506af5a984cac64fae81f2 Mon Sep 17 00:00:00 2001
From: Caio Lente <7017340+clente@users.noreply.github.com>
Date: Thu, 4 Jan 2024 17:32:06 -0300
Subject: Update author param
---
README.md | 12 ++++++------
exampleSite/config.toml | 12 ++++++------
layouts/partials/social_card.html | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index d5b77dd..0636c04 100644
--- a/README.md
+++ b/README.md
@@ -145,11 +145,6 @@ defaultContentLanguage = "en"
# Generate a nice robots.txt for SEO
enableRobotsTXT = true
-# Your name. For more information on why this must be a list, see
-# https://discourse.gohugo.io/t/site-author-usage/31459/8
-[author]
- name = "John Doe"
-
# Setup syntax highlighting without inline styles. For more information about
# why you'd want to avoid inline styles, see
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles
@@ -215,9 +210,14 @@ enableRobotsTXT = true
# Social media. Delete any item you aren't using to make sure it won't show up
# in your website's metadata.
[params.social]
- email = "me@example.com" # Added to the footer so readers can reply to posts
twitter = "example" # Twitter handle (without '@')
facebook_admin = "0000000000" # Facebook Page Admin ID
+
+ # Author metadata. This is mostly used for the RSS feed of your site, but the
+ # email is also added to the footer of each post
+ [params.author]
+ name = "John Doe" # Your name as shown in the RSS feed metadata
+ email = "me@example.com" # Added to the footer so readers can reply to posts
```
## Contributing
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 9e1f9c9..6fe641f 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -7,11 +7,6 @@ defaultContentLanguage = "en"
# Generate a nice robots.txt for SEO
enableRobotsTXT = true
-# Your name. For more information on why this must be a list, see
-# https://discourse.gohugo.io/t/site-author-usage/31459/8
-[author]
- name = "John Doe"
-
# Setup syntax highlighting without inline styles. For more information about
# why you'd want to avoid inline styles, see
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles
@@ -77,6 +72,11 @@ enableRobotsTXT = true
# Social media. Delete any item you aren't using to make sure it won't show up
# in your website's metadata.
[params.social]
- email = "me@example.com" # Added to the footer so readers can reply to posts
twitter = "example" # Twitter handle (without '@')
facebook_admin = "0000000000" # Facebook Page Admin ID
+
+ # Author metadata. This is mostly used for the RSS feed of your site, but the
+ # email is also added to the footer of each post
+ [params.author]
+ name = "John Doe" # Your name as shown in the RSS feed metadata
+ email = "me@example.com" # Added to the footer so readers can reply to posts
diff --git a/layouts/partials/social_card.html b/layouts/partials/social_card.html
index c55d56a..74f1b88 100644
--- a/layouts/partials/social_card.html
+++ b/layouts/partials/social_card.html
@@ -13,7 +13,7 @@
)) }}
{{ $date := .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }}
-{{ $author := (default $.Site.Author.name ($.Param "author") ) }}
+{{ $author := (default $.Site.Params.author.name ($.Param "author") ) }}
{{ $byline := (printf "%s | %s" $author $date) }}
{{ $fg = $fg.Filter (images.Text $byline (dict
--
cgit v1.2.3