diff --git a/README.md b/README.md index fde0b92..429fc89 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 45271af..04e5450 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -4,9 +4,9 @@ if (location.host != new URL("{{ .Site.BaseURL }}").host) location.href = "{{ .Site.BaseURL }}" {{ end }} - - - + + + {{ 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" }} {{- partial "inject/head.html" . -}} + {{- partial "head_meta_seo.html" . -}} {{- partial "head_meta_opengraph.html" . -}} diff --git a/layouts/partials/head_meta_opengraph.html b/layouts/partials/head_meta_opengraph.html index b8bd1bb..06b0b79 100644 --- a/layouts/partials/head_meta_opengraph.html +++ b/layouts/partials/head_meta_opengraph.html @@ -9,18 +9,27 @@ - {{ range .Params.tags }} - + {{ if .Params.tags }} + {{ range .Params.tags }} + + {{ end }} {{ end }} - + {{ if .Params.description }} + + {{ else }} + + {{ end }} {{ else }} + {{ if .Site.Params.description }} + + {{ end }} diff --git a/layouts/partials/head_meta_seo.html b/layouts/partials/head_meta_seo.html new file mode 100644 index 0000000..3780fab --- /dev/null +++ b/layouts/partials/head_meta_seo.html @@ -0,0 +1,15 @@ + +{{ if .IsPage }} + {{ if .Params.tags }} + + {{ end }} + {{ if .Params.description }} + + {{ else }} + + {{ end }} +{{ else }} + {{ if .Site.Params.description }} + + {{ end }} +{{ end }}