Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add license metadata #518

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ listDateFormat = "2/1/2006"
# postSectionName = "blog"
# relatedPosts = true
# numberOfRelatedPosts = 3
# Full link to license
#license = "https://creativecommons.org/licenses/by/4.0/"


reversepagetitle = true # When set to 'true', the Window Title will be reversed to 'Title | Author' instead of the default 'Author | Title'
Expand Down
4 changes: 4 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
<link rel="icon" type="image/png" sizes="16x16" href="{{ .Site.Params.favicon | relURL }}favicon-16x16.png" />

<link rel="canonical" href="{{ .Permalink }}" />
<!-- License -->
{{- with .Site.Params.license -}}
<link rel="license" href="{{ . }}"/>
{{- end -}}

<!-- RSS -->
{{ with .OutputFormats.Get "rss" -}}
Expand Down
12 changes: 10 additions & 2 deletions layouts/partials/schema.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"url": "{{ .Site.BaseURL }}",
"description": "{{ .Site.Params.description }}",
"thumbnailUrl": "{{ .Site.Params.Logo | absURL }}",
"license": "{{ .Site.Params.Copyright }}"
"license": "{{ .Site.Params.license}}"
{{ with .Site.Params.copyright }}
{{ $copyright := replace . "{{ YEAR }}" (now.Format "2006") }}
,"copyrightYear": "{{ index (findRE `^\d{4}` $copyright 1) 0 }}"
{{ end }}
}
</script>
{{ else if .IsPage }}
Expand All @@ -34,6 +38,11 @@


{{ end }}",
"license": "{{ .Site.Params.license}}",
{{ with .Site.Params.copyright }}
{{ $copyright := replace . "{{ YEAR }}" (now.Format "2006") }}
"copyrightYear": "{{ index (findRE `^\d{4}` $copyright 1) 0 }}",
{{ end }}
"inLanguage": {{ .Site.LanguageCode | default "en-us" }},
"isFamilyFriendly": "true",
"mainEntityOfPage": {
Expand All @@ -56,7 +65,6 @@
"@type": "Person",
"name": "{{ $author }}"
},
"copyrightYear" : "{{ .Date.Format "2006" }}",
"dateCreated": "{{ .Date.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
Expand Down