More meta tags

This commit is contained in:
Jan-Lukas Else 2020-11-09 17:04:20 +01:00
parent 5b9ac19cb8
commit 53c55c9a6b
3 changed files with 21 additions and 8 deletions

View File

@ -188,7 +188,6 @@ func initConfig() error {
viper.SetDefault("cache.enable", true)
viper.SetDefault("cache.expiration", 600)
viper.SetDefault("user.nick", "admin")
viper.SetDefault("user.name", "Admin")
viper.SetDefault("user.password", "secret")
viper.SetDefault("hooks.shell", "/bin/bash")
viper.SetDefault("hugo.frontmatter", []*frontmatter{{Meta: "title", Parameter: "title"}, {Meta: "tags", Parameter: "tags"}})

View File

@ -7,6 +7,6 @@
href="{{ $item.Link }}">{{ $item.Title }}</a>{{ $first = false }}
{{ end }}
{{ end }}
<p>&copy; {{ dateformat now "2006" }} {{ .Blog.Title }}</p>
<p>&copy; {{ dateformat now "2006" }} {{ with user.Name }}{{ . }}{{ else }}{{ .Blog.Title }}{{ end }}</p>
</footer>
{{ end }}

View File

@ -1,13 +1,27 @@
{{ define "postheadmeta" }}
<meta name="description" content="{{ with summary .Data }}{{ . }}{{ end }}">
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
{{ if .Data.Published }}
<meta itemprop="datePublished" content="{{ dateformat .Data.Published $ISO8601 }}">
{{ with .Canonical }}
<meta property="og:url" content="{{ . }}">
<meta property="twitter:url" content="{{ . }}">
{{ end }}
{{ if .Data.Updated }}
<meta itemprop="dateModified" content="{{ dateformat .Data.Updated $ISO8601 }}">
{{ with title .Data }}
<meta property="og:title" content="{{ . }}">
<meta property="twitter:title" content="{{ . }}">
{{ end }}
{{ with summary .Data }}
<meta name="description" content="{{ . }}">
<meta property="og:description" content="{{ . }}">
<meta property="twitter:description" content="{{ . }}">
{{ end }}
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
{{ with .Data.Published }}
<meta itemprop="datePublished" content="{{ dateformat . $ISO8601 }}">
{{ end }}
{{ with .Data.Updated }}
<meta itemprop="dateModified" content="{{ dateformat . $ISO8601 }}">
{{ end }}
{{ range $key, $image := ps .Data "images" }}
<meta itemprop="image" content="{{ $image }}">
<meta property="og:image" content="{{ $image }}">
<meta property="twitter:image" content="{{ $image }}">
{{ end }}
{{ end }}