mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-25 06:20:40 +00:00
add meta elements and fix title
This commit is contained in:
parent
ffbb01c288
commit
1cb88d9e6c
@ -1 +1,5 @@
|
|||||||
- initial release
|
- ENHANCEMENT
|
||||||
|
- allow setting some common meta elements e.g. description and authors
|
||||||
|
- prevent duplicate title on the start page
|
||||||
|
- BUGFIX
|
||||||
|
- dont display duplicate title on home page
|
||||||
|
@ -128,6 +128,14 @@ enableGitInfo = true
|
|||||||
[geekblogContentLicense]
|
[geekblogContentLicense]
|
||||||
name = "CC BY-SA 4.0"
|
name = "CC BY-SA 4.0"
|
||||||
link = "https://creativecommons.org/licenses/by-sa/4.0/"
|
link = "https://creativecommons.org/licenses/by-sa/4.0/"
|
||||||
|
|
||||||
|
# (Optional, default none) Default meta description used for the start page and as a fallback for
|
||||||
|
# every site without an own description.
|
||||||
|
geekblogDescription = "This is my personal blog about tech."
|
||||||
|
|
||||||
|
# (Optional, default none) Default meta keywords used for the start page and as a fallback for
|
||||||
|
# every site without own keywords. Note: Meta keywords seems to be ignored by most modern search engines.
|
||||||
|
geekblogKeywords =
|
||||||
```
|
```
|
||||||
|
|
||||||
{{< /tab >}}
|
{{< /tab >}}
|
||||||
@ -231,6 +239,14 @@ params:
|
|||||||
geekblogContentLicense:
|
geekblogContentLicense:
|
||||||
name: CC BY-SA 4.0
|
name: CC BY-SA 4.0
|
||||||
link: https://creativecommons.org/licenses/by-sa/4.0/
|
link: https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
|
|
||||||
|
# (Optional, default none) Default meta description used for the start page and as a fallback for
|
||||||
|
# every site without an own description.
|
||||||
|
geekblogDescription: "This is my personal blog about tech."
|
||||||
|
|
||||||
|
# (Optional, default none) Default meta keywords used for the start page and as a fallback for
|
||||||
|
# every site without own keywords. Note: Meta keywords seems to be ignored by most modern search engines.
|
||||||
|
geekblogKeywords: []
|
||||||
```
|
```
|
||||||
|
|
||||||
{{< /tab >}}
|
{{< /tab >}}
|
||||||
|
@ -3,6 +3,7 @@ title: "Post with image"
|
|||||||
date: 2020-06-22T20:00:00+02:00
|
date: 2020-06-22T20:00:00+02:00
|
||||||
authors:
|
authors:
|
||||||
- richard-roe
|
- richard-roe
|
||||||
|
- john-doe
|
||||||
tags:
|
tags:
|
||||||
- Open Source
|
- Open Source
|
||||||
- Development
|
- Development
|
||||||
|
@ -1,8 +1,26 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="description" content="{{ partial "title" . }}">
|
{{ $description := default .Site.Params.GeekblogDescription (default .Summary .Description) }}
|
||||||
|
{{ $keywords := default .Site.Params.GeekblogKeywords .Keywords }}
|
||||||
|
{{ $author := default (slice .Site.Params.GeekblogAuthor) .Params.authors }}
|
||||||
|
{{ with $description }}
|
||||||
|
<meta name="description" content="{{ . }}">
|
||||||
|
{{ end }}
|
||||||
|
{{ with $keywords }}
|
||||||
|
<meta name="keywords" content="{{ delimit . "," }}">
|
||||||
|
{{ end }}
|
||||||
|
{{ with $author }}
|
||||||
|
{{ $authors := slice }}
|
||||||
|
{{ range sort . }}
|
||||||
|
{{ $author := index $.Site.Data.authors . }}
|
||||||
|
{{ $authors = $authors | append $author.name }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<title>{{ partial "title" . }} | {{ .Site.Title -}}</title>
|
{{ with $authors }}
|
||||||
|
<meta name="author" content="{{ delimit . "," }}">
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
<title>{{ if not (eq .Kind "home") }}{{ partial "title" . }} | {{ end }}{{ .Site.Title -}}</title>
|
||||||
|
|
||||||
<link rel="icon" href="{{ "favicon/favicon-32x32.png" | relURL }}" type="image/x-icon">
|
<link rel="icon" href="{{ "favicon/favicon-32x32.png" | relURL }}" type="image/x-icon">
|
||||||
<link rel="stylesheet" href="{{ "main.min.css" | relURL }}" media="screen">
|
<link rel="stylesheet" href="{{ "main.min.css" | relURL }}" media="screen">
|
||||||
|
@ -8,4 +8,8 @@
|
|||||||
{{ $title = .File.BaseFileName | humanize | title }}
|
{{ $title = .File.BaseFileName | humanize | title }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if eq .Kind "term" }}
|
||||||
|
{{ $title = $title | humanize | title }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ return $title }}
|
{{ return $title }}
|
||||||
|
Loading…
Reference in New Issue
Block a user