added general meta tags for seo; added some article params to readme

This commit is contained in:
Gabriele Musco 2021-04-18 10:50:02 +02:00
parent d44a15e66f
commit bff5aa0b1e
No known key found for this signature in database
GPG Key ID: 8539FD3454380B83
4 changed files with 40 additions and 6 deletions

View File

@ -34,6 +34,8 @@ summaryLength = 70 # number of words for article summaries
[params]
author = "Gabriele Musco"
description = "A description for my website" # this will be added as metadata
logo = "/images/mylogo.png"
favicon = "/images/myfavicon.png"
showTags = true # show the Tags menu item; default true
@ -166,6 +168,13 @@ Following is an example configuration:
link: https://gitlab.gnome.org/gabmus
```
## Params supported in a post frontmatter
| Param | Description |
|-------|-------------|
| `tags` | An array of tags, useful for searching similar articles |
| `description` | A brief description of the post, useful for SEO optimization |
| `featured` | Boolean, indicate if the post should be shown as featured |
## Inject custom content

View File

@ -4,9 +4,9 @@
if (location.host != new URL("{{ .Site.BaseURL }}").host) location.href = "{{ .Site.BaseURL }}"
</script>
{{ end }}
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=7">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
{{ if .OutputFormats.Get "RSS" }}
{{ with .OutputFormats.Get "RSS" }}
@ -28,5 +28,6 @@
{{ $style := resources.Get "/scss/style.scss" | resources.ExecuteAsTemplate "/scss/style.scss" . | resources.ToCSS (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") | resources.Fingerprint "sha512" }}
<link type=text/css rel=stylesheet href={{ $style.Permalink }} integrity="{{ $style.Data.Integrity }}" />
{{- partial "inject/head.html" . -}}
{{- partial "head_meta_seo.html" . -}}
{{- partial "head_meta_opengraph.html" . -}}
</head>

View File

@ -9,18 +9,27 @@
<meta
property="article:published_time"
content='{{ .Date.Format "2006-01-02T15:04:05Z-0700" }}' />
{{ range .Params.tags }}
<meta property="article:tag" content="{{ . }}" />
{{ if .Params.tags }}
{{ range .Params.tags }}
<meta property="article:tag" content="{{ . }}" />
{{ end }}
{{ end }}
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:image"
content='{{ if .Params.Image }}{{ .Params.Image | absURL }}
{{ else }}{{ .Site.Params.Logo | default "/img/icon.svg" | absURL }}
{{ end }}' />
<meta property="og:description" content="{{ .Summary }}" />
{{ if .Params.description }}
<meta property="og:description" content="{{ .Params.description }}" />
{{ else }}
<meta property="og:description" content="{{ substr .Summary 20 }}" />
{{ end }}
{{ else }}
<meta property="og:title"
content='{{ .Site.Title | default "Ficurinia" }}' />
{{ if .Site.Params.description }}
<meta name="og:description" content="{{ .Site.Params.description }}" />
{{ end }}
<meta property="og:type" content="blog" />
<meta property="og:image"
content='{{ .Site.Params.Logo | default "/img/icon.svg" | absURL }}' />

View File

@ -0,0 +1,15 @@
<meta name="author" content="{{ .Site.Params.Author }}" />
{{ if .IsPage }}
{{ if .Params.tags }}
<meta name="keywords" content='{{ delimit .Params.tags ", "}}' />
{{ end }}
{{ if .Params.description }}
<meta name="description" content="{{ .Params.description }}" />
{{ else }}
<meta name="description" content="{{ substr .Summary 20 }}" />
{{ end }}
{{ else }}
{{ if .Site.Params.description }}
<meta name="description" content="{{ .Site.Params.description }}" />
{{ end }}
{{ end }}