mirror of https://github.com/jpanther/congo.git
✨ Add JSON-LD structured metadata
parent
9d3af655f4
commit
c5107ab693
|
@ -17,11 +17,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
- Recent articles partial
|
- Recent articles partial
|
||||||
- CSS transitions
|
- CSS transitions
|
||||||
- Hugo module support
|
- Hugo module support
|
||||||
|
- JSON-LD structured metadata
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- ⚠️ Renamed parameter: `homepage.showList` -> `homepage.showRecent`
|
- ⚠️ Renamed parameter: `homepage.showList` -> `homepage.showRecent`
|
||||||
- ⚠️ Renamed parameter: `homepage.listSections` -> `homepage.mainSections`
|
- ⚠️ Renamed parameter: `homepage.listSections` -> `mainSections`
|
||||||
- ⚠️ Consolidated author configuration parameters into `config.toml`
|
- ⚠️ Consolidated author configuration parameters into `config.toml`
|
||||||
- General style tweaks to enhance design consistency
|
- General style tweaks to enhance design consistency
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
# Refer to the theme docs for more details about each of these parameters.
|
# Refer to the theme docs for more details about each of these parameters.
|
||||||
# https://jpanther.github.io/Congo/docs/configuration/#theme-parameters
|
# https://jpanther.github.io/Congo/docs/configuration/#theme-parameters
|
||||||
|
|
||||||
|
# description = "My awesome website"
|
||||||
|
# mainSections = ["section1", "section2"]
|
||||||
|
|
||||||
[homepage]
|
[homepage]
|
||||||
layout = "page" # valid options: page, profile, custom
|
layout = "page" # valid options: page, profile, custom
|
||||||
showRecent = false
|
showRecent = false
|
||||||
# mainSections = ["section1", "section2"]
|
|
||||||
|
|
||||||
[article]
|
[article]
|
||||||
showDate = true
|
showDate = true
|
||||||
|
|
|
@ -56,9 +56,10 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
|Name|Type|Default|Description|
|
|Name|Type|Default|Description|
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
|
|`description`|string|_Not set_|The description of the website for metadata purposes.|
|
||||||
|
|`mainSections`|array of strings|_Not set_|The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used.|
|
||||||
|`homepage.layout`|string|`"page"`|The layout of the homepage. Valid values are `page`, `profile` or `custom`. When set to `custom`, you must provide your own layout by creating a `/layouts/partials/home/custom.html` file. Refer to the [Homepage Layout](/docs/homepage-layout/) section for more details.|
|
|`homepage.layout`|string|`"page"`|The layout of the homepage. Valid values are `page`, `profile` or `custom`. When set to `custom`, you must provide your own layout by creating a `/layouts/partials/home/custom.html` file. Refer to the [Homepage Layout](/docs/homepage-layout/) section for more details.|
|
||||||
|`homepage.showRecent`|boolean|`false`|Whether or not to display the recent articles list on the homepage.|
|
|`homepage.showRecent`|boolean|`false`|Whether or not to display the recent articles list on the homepage.|
|
||||||
|`homepage.mainSections`|array of strings|_Not set_|The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used.|
|
|
||||||
|`article.showDate`|boolean|`true`|Whether or not article dates are displayed.|
|
|`article.showDate`|boolean|`true`|Whether or not article dates are displayed.|
|
||||||
|`article.dateFormat`|string|`"2 January 2006"`|How article dates are formatted. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.|
|
|`article.dateFormat`|string|`"2 January 2006"`|How article dates are formatted. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.|
|
||||||
|`article.showAuthor`|boolean|`true`|Whether or not the author box is displayed in the article footer.|
|
|`article.showAuthor`|boolean|`true`|Whether or not the author box is displayed in the article footer.|
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
{{ template "_internal/opengraph.html" . }}
|
{{ template "_internal/opengraph.html" . }}
|
||||||
{{ template "_internal/twitter_cards.html" . }}
|
{{ template "_internal/twitter_cards.html" . }}
|
||||||
{{/* Schema */}}
|
{{/* Schema */}}
|
||||||
{{ template "_internal/schema.html" . }}
|
{{ partial "schema.html" . }}
|
||||||
{{/* Generator */}}
|
{{/* Generator */}}
|
||||||
{{ if .Site.Params.attribution | default true }}
|
{{ if .Site.Params.attribution | default true }}
|
||||||
{{ hugo.Generator }}
|
{{ hugo.Generator }}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{{ if .Site.Params.homepage.showRecent | default false }}
|
{{ if .Site.Params.homepage.showRecent | default false }}
|
||||||
<h2 class="mt-8 text-2xl font-extrabold">{{ i18n "shortcode.recent_articles" | emojify }}</h2>
|
<h2 class="mt-8 text-2xl font-extrabold">{{ i18n "shortcode.recent_articles" | emojify }}</h2>
|
||||||
{{ range first 5 (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.homepage.mainSections)).Pages }}
|
{{ range first 5 (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages }}
|
||||||
{{ partial "article-link.html" . }}
|
{{ partial "article-link.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
{{ if .IsHome -}}
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@type": "WebSite",
|
||||||
|
"name": "{{ .Site.Title | safeJS }}",
|
||||||
|
"url": "{{ .Site.BaseURL | safeURL }}",
|
||||||
|
"description": "{{ .Site.Params.description | safeJS }}"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{ else if .IsPage }}
|
||||||
|
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@type": "BlogPosting",
|
||||||
|
"articleSection": "{{ (site.GetPage .Section).Title }}",
|
||||||
|
"name": "{{ .Title | safeJS }}",
|
||||||
|
"headline": "{{ .Title | safeJS }}",
|
||||||
|
"description": "{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}",
|
||||||
|
{{ with .Site.LanguageCode }}"inLanguage": {{ . }},{{ end }}
|
||||||
|
"author" : {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": "{{ .Site.Author.name | safeJS }}"
|
||||||
|
},
|
||||||
|
"creator" : {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": "{{ .Site.Author.name | safeJS }}"
|
||||||
|
},
|
||||||
|
"copyrightHolder": "{{ .Site.Author.name | safeJS }}",
|
||||||
|
{{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }}
|
||||||
|
{{ with .PublishDate }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }}
|
||||||
|
{{ with .PublishDate }}"datePublished": "{{ .Format $iso8601 }}",{{ end }}
|
||||||
|
{{ with .Lastmod }}"dateModified": "{{ .Format $iso8601 }}",{{ end }}
|
||||||
|
"url" : "{{ .Permalink }}",
|
||||||
|
"wordCount": "{{ .WordCount }}",
|
||||||
|
"keywords": [{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}]
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{ end }}
|
Loading…
Reference in New Issue