diff --git a/assets/images/og-image.jpg b/assets/images/og-image.jpg new file mode 100644 index 00000000..136bc98f Binary files /dev/null and b/assets/images/og-image.jpg differ diff --git a/config/_default/params.toml b/config/_default/params.toml index e0b92716..a0e46266 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -19,6 +19,14 @@ logo_width = "130px" mainSections = ["blog"] mobile = "+211234565523" fullSiteSearch = true + +# seo meta data for OpenGraph / Twitter Card +[metadata] +keywords = ["Intelops", "Cloud-Native", "Ai", "DevOps", "SRE", "Kubernetes", "Talent", "Democratize", "Next-Gen"] +description = "DevSecOps concept in development and testing" +author = "Intelops" +image = "images/og-image.jpg" # this image will be used as fallback if a page has no image of its own + [footer] footer_light = false # bg_color = "#1e384c" diff --git a/themes/delta/layouts/partials/head.html b/themes/delta/layouts/partials/head.html index 8d11d61c..7aec2f62 100644 --- a/themes/delta/layouts/partials/head.html +++ b/themes/delta/layouts/partials/head.html @@ -40,35 +40,7 @@ - -{{ "" | safeHTML }} -{{ $image_path := .Params.image | default site.Params.image -}} -{{ $image_path_local := printf "static/%s" $image_path -}} -{{ $image_ext := trim (path.Ext $image_path | lower) "." -}} -{{ if fileExists $image_path_local -}} - - {{/* If not SVG, read image aspect ratio and define Twitter Card and Open Graph width and height */ -}} - {{ if ne $image_ext "svg" -}} - {{ with (imageConfig $image_path_local) -}} - {{ if (and (gt .Width 144) (gt .Height 144)) -}} - - - {{ end -}} - - - {{ end -}} - {{ end -}} - -{{ end -}} - - -{{ with site.Social.twitter -}}{{ end -}} -{{ range site.Authors }} - {{ with .twitter -}}{{ end -}} -{{ end -}} - {{ partial "opengraph.html" . }} -{{ template "_internal/twitter_cards.html" . }} {{ template "_internal/google_analytics.html" . }} \ No newline at end of file diff --git a/themes/delta/layouts/partials/opengraph.html b/themes/delta/layouts/partials/opengraph.html index 4ce4ef9b..e80a46c3 100644 --- a/themes/delta/layouts/partials/opengraph.html +++ b/themes/delta/layouts/partials/opengraph.html @@ -1,34 +1,172 @@ - - - + +{{ if or (eq site.BaseURL "/") (eq site.BaseURL "http://localhost:1313/") (eq site.BaseURL "http://examplesite.org/") (eq site.BaseURL "https://examplesite.org/") (eq site.BaseURL "http://examplesite.com/") (eq site.BaseURL "https://examplesite.com/") }} +{{ else }} + +{{ end }} + + + +{{ if .Params.noindex }} + +{{ end }} + + + + + + +{{ if .IsTranslated }} + {{ range .AllTranslations }} + + {{ end }} + +{{ end }} + + + +{{ if .Params.keywords }} + +{{ else if site.Params.metadata.keywords }} + +{{ end }} + + + + + + +{{ with site.Params.metadata.author }} + +{{ end }} + + + +{{ hugo.Generator }} + + + +{{ $title := site.Title }} +{{ if .Params.og_title }} + {{ $title = .Params.og_title }} + +{{ else if .Title }} + {{ $title = .Title }} + +{{ else if site.Params.metadata.title }} + {{ $title = site.Params.metadata.title }} +{{ end }} + + + +{{ $description := .Summary }} +{{ if .Params.og_description }} + {{ $description = .Params.og_description }} + +{{ else if .Params.description }} + {{ $description = .Params.description }} + +{{ else if site.Params.metadata.description }} + {{ $description = site.Params.metadata.description }} +{{ end }} + + + +{{ $imagePath := site.Params.metadata.image }} +{{ if .Params.og_image }} + {{ $imagePath = .Params.og_image }} + +{{ else if .Params.images }} + {{ range first 1 .Params.images }} + {{ $imagePath = . }} + {{ end }} + +{{ else if .Params.image }} + {{ $imagePath = .Params.image }} +{{ end }} + + + + + +{{ if or (hasPrefix $imagePath "http") (fileExists (add `static/` (string $imagePath))) }} + + + +{{ else }} + + + + {{ $contentImage:= .Resources.GetMatch (printf "*%s*" $imagePath) }} + {{ $assetImage:= fileExists (add `assets/` (string $imagePath)) }} + + + + {{ if or $contentImage $assetImage }} + + {{ if $contentImage }} + {{ .Scratch.Set "image-exists" $contentImage }} + {{ else if $assetImage }} + {{ .Scratch.Set "image-exists" (resources.Get $imagePath) }} + {{ end }} + + {{ $image:= .Scratch.Get "image-exists" }} + + + + {{ $imageExt:= path.Ext $image }} + + + + {{ if ne $imageExt `.svg` }} + {{ $imageWidth := $image.Width }} + {{ $imageHeight := $image.Height }} + {{ if (and (gt $imageWidth 144) (gt $imageHeight 144)) }} + + + + {{ end }} + + + + {{ end }} + + + + + {{ end }} + + +{{ end }} + + + + + + + -{{- with $.Params.images -}} -{{- range first 6 . }}{{ end -}} -{{- else -}} -{{- $images := $.Resources.ByType "image" -}} -{{- $featured := $images.GetMatch "*feature*" -}} -{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} -{{- with $featured -}} - -{{- else -}} -{{- with $.Site.Params.images }}{{ end -}} -{{- end -}} -{{- end -}} - -{{- if .IsPage }} -{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} - -{{ with .PublishDate }}{{ end }} -{{ with .Lastmod }}{{ end }} -{{- end -}} - -{{- with .Params.audio }}{{ end }} -{{- with .Params.locale }}{{ end }} -{{- with .Site.Params.title }}{{ end }} -{{- with .Params.videos }}{{- range . }} - -{{ end }}{{ end }} - -{{- /* Facebook Page Admin ID for Domain Insights */}} -{{- with .Site.Social.facebook_admin }}{{ end }} \ No newline at end of file + + + + +{{ with site.Social.twitter }} + +{{ end }} +{{ range site.Authors }} + {{ with .twitter }}{{ end }} +{{ end }} \ No newline at end of file diff --git a/themes/delta/layouts/partials/style.html b/themes/delta/layouts/partials/style.html index 3dcefcd5..6edfe54e 100644 --- a/themes/delta/layouts/partials/style.html +++ b/themes/delta/layouts/partials/style.html @@ -27,5 +27,5 @@ {{ end }} {{ end }} {{ $styles := $styles | append (resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "style.scss" . | toCSS) }} -{{ $styles := $styles | resources.Concat "/css/style.css" | minify | fingerprint "sha512"}} +{{ $styles := $styles | resources.Concat "/css/style.css" | fingerprint "sha512"}} \ No newline at end of file