diff --git a/exampleSite/config.toml b/exampleSite/config.toml index e7e58ad..9a9a13c 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -22,6 +22,7 @@ style = 'monokailight' tabWidth = 4 [params] +description = "Example site for hugo-theme-flat" mainSections = ['posts'] ## uncomment belows and set proper values to enable remark42 diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index fc62752..563e273 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,7 +1,6 @@ - {{ with .Params.Title }}{{ . }} | {{ end }}{{ .Site.Title }} {{ partial "head.html" . }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 9748b0e..79797de 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,6 +1,37 @@ + +{{ $title := .Site.Title -}} +{{ if .Params.Title -}} + {{ $title = printf "%s | %s" .Params.Title $title -}} +{{ end -}} + +{{ $description := "" -}} +{{ if .IsHome -}} + {{ with .Site.Params.description }}{{ $description = . }}{{ end -}} +{{ else if .IsPage -}} + {{ if .Description -}} + {{ $description = .Description -}} + {{ else -}} + {{ $description = .Summary -}} + {{ end -}} +{{ end }} + +{{ $title }} + +{{ if $description -}} + +{{ end -}} + + + + +{{ if $description -}} + +{{ end -}} + + {{ range .AlternativeOutputFormats -}} {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}}