Skip to content

Commit

Permalink
Site.Author is deprecated, use Params.author instead (#481)
Browse files Browse the repository at this point in the history
* Site.Author is deprecated, use Params.author instead

* Update footer.html

* Update footer.html

* Update footer.html

* Update footer.html

* Update footer.html

* Update footer.html

* Update footer.html

* Update ci.yml

* Update ci.yml

* Update footer.html

* Update ci.yml

* Update ci.yml

---------

Co-authored-by: Henry Schreiner <[email protected]>
  • Loading branch information
Rivierg and henryiii authored Jul 10, 2024
1 parent 89594f9 commit a48a6fa
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 22 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ jobs:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/" \
-s "./exampleSite/" \
--themesDir "../../"
run: >
hugo
--minify
--baseURL "${{ steps.pages.outputs.base_url }}/"
-s "./exampleSite/"
--themesDir "../../"
--logLevel info
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pygmentsCodefencesGuessSyntax = true
# src = "img/hexagon.jpg"
# desc = "Hexagon"

[Author]
[Params.author]
# Set only your "username" for default hosts and full URLs otherwise (e.g., "https://MyGitLab.org/username")
name = "Some Person"
website = "yourwebsite.com"
Expand Down
19 changes: 11 additions & 8 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{{ if eq .Type "page" }}
{{ partial "page_meta.html" . }}
{{ end }}
{{- if and (not (isset .Site.Params "author")) (isset .Site "author") -}}
{{ errorf "Please move [author] to [params.author]; Hugo has deprecated the former." }}
{{- end -}}
<footer>
<div class="container">
{{ if .Site.Params.disclaimerText }}
Expand All @@ -14,12 +17,12 @@
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<ul class="list-inline text-center footer-links">
{{ range .Site.Data.beautifulhugo.social.social_icons }}
{{- if isset $.Site.Author .id }}
{{- if isset $.Site.Params.author .id }}
<li>
{{ if or ( hasPrefix ( index $.Site.Author .id ) "http://" ) ( hasPrefix ( index $.Site.Author .id ) "https://" ) }}
<a {{ if .rel }}rel="{{ .rel }}"{{- end -}} href="{{ printf "%s" (index $.Site.Author .id) }}" title="{{ .title }}">
{{ if or ( hasPrefix ( index $.Site.Params.author .id ) "http://" ) ( hasPrefix ( index $.Site.Params.author .id ) "https://" ) }}
<a {{ if .rel }}rel="{{ .rel }}"{{- end -}} href="{{ printf "%s" (index $.Site.Params.author .id) }}" title="{{ .title }}">
{{ else }}
<a {{ if .rel }}rel="{{ .rel }}"{{- end -}} href="{{ printf .url (index $.Site.Author .id) }}" title="{{ .title }}">
<a {{ if .rel }}rel="{{ .rel }}"{{- end -}} href="{{ printf .url (index $.Site.Params.author .id) }}" title="{{ .title }}">
{{ end }}
<span class="fa-stack fa-lg">
<i class="fas fa-circle fa-stack-2x"></i>
Expand All @@ -41,11 +44,11 @@
{{ end }}
</ul>
<p class="credits copyright text-muted">
{{ if .Site.Author.name }}
{{ if .Site.Author.website }}
<a href="{{ .Site.Author.website }}">{{ .Site.Author.name }}</a>
{{ if .Site.Params.author.name }}
{{ if .Site.Params.author.website }}
<a href="{{ .Site.Params.author.website }}">{{ .Site.Params.author.name }}</a>
{{ else }}
{{ .Site.Author.name }}
{{ .Site.Params.author.name }}
{{ end }}
{{ end }}

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{{- with ($.Scratch.Get "Description") }}
<meta name="description" content="{{ . }}">
{{- end }}
{{- with .Site.Author.name }}
{{- with .Site.Params.author.name }}
<meta name="author" content="{{ . }}"/>
{{- end }}
{{- partial "seo/main.html" . }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/post_meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
&nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Params.author | safeHTML }}
{{ end }}
{{ else }}
&nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Site.Author.name | safeHTML }}
&nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Site.Params.author.name | safeHTML }}
{{ end }}
{{ end }}
{{- if .Site.Params.staticman -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/seo/structured/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"@context": "http://schema.org",
"@type": "Article",
"author": {
"name" : "{{ if .Params.author -}}{{ .Params.author }}{{- else if .Site.Author.name -}}{{ .Site.Author.name }}{{- end }}"
"name" : "{{ if .Params.author -}}{{ .Params.author }}{{- else if .Site.Params.author.name -}}{{ .Site.Params.author.name }}{{- end }}"
},
"headline": "{{ .Title }}",
"description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}",
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/seo/structured/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"@type": "Person",
"name": "{{ .Params.author }}"
},
{{- else if .Site.Author.name -}}
{{- else if .Site.Params.author.name -}}
"author": {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
"name": "{{ .Site.Params.author.name }}"
},
{{- end }}
"copyrightYear" : "{{ .Site.Params.since }} - {{ .Site.LastChange.Format "2006" }}",
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/seo/twitter.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="twitter:image" content="{{ . | absURL }}" />
{{- end }}
<meta name="twitter:card" content="summary_large_image" />
{{- with .Site.Author.twitter }}
{{- with .Site.Params.author.twitter }}
<meta name="twitter:site" content="@{{ . }}" />
<meta name="twitter:creator" content="@{{ . }}" />
{{- end }}
2 changes: 1 addition & 1 deletion layouts/partials/share-links.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ul class="share">
<!-- Twitter -->
<li>
<a href="//twitter.com/share?url={{ .Permalink }}&amp;text={{ .Title }}&amp;via={{ .Site.Author.twitter }}" target="_blank" title="Share on Twitter">
<a href="//twitter.com/share?url={{ .Permalink }}&amp;text={{ .Title }}&amp;via={{ .Site.Params.author.twitter }}" target="_blank" title="Share on Twitter">
<i class="fab fa-twitter"></i>
</a>
</li>
Expand Down

0 comments on commit a48a6fa

Please sign in to comment.