diff --git a/.github/settings.yml b/.github/settings.yml index 2e99f1e..2a9c0cf 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -2,7 +2,7 @@ repository: name: hugo-geekblog description: Hugo theme made for blogs - homepage: https://geekblog.geekdocs.de + homepage: https://hugo-geekblog.geekdocs.de topics: hugo, theme, hugo-theme, blog private: false diff --git a/exampleSite/config.yml b/exampleSite/config.yml index fbae7fd..b5279a9 100644 --- a/exampleSite/config.yml +++ b/exampleSite/config.yml @@ -1,5 +1,5 @@ --- -baseURL: https://hugo-geekblog.geekdocs.de/ +baseURL: https://hugo-geekblog.geekblogs.de/ title: Geekblog theme: hugo-geekblog pygmentsUseClasses: true @@ -17,3 +17,47 @@ markup: taxonomies: author: authors tag: tags + +mediaTypes: + "application/atom+xml": + suffixes: + - "xml" + +outputFormats: + Atom: + # https://validator.w3.org/feed/docs/atom.html#whatIsAtom + name: "Atom" + mediaType: "application/atom+xml" + # generated file: . = atom.xml + baseName: "atom" + isPlainText: false + rel: "alternate" + isHTML: false + noUgly: true + permalinkable: false + +outputs: + home: + - HTML + - ATOM + page: + - HTML + section: + - HTML + taxonomy: + - HTML + term: + - HTML + - ATOM + +params: + geekblogSubtitle: Subtitle to describe your blog + geekblogToC: 3 + GeekblogAuthor: john-doe + + geekblogDateFormat: "Jan 2, 2006" + + geekblogLegalNotice: https://geeklabor.de/legal-notice/#impressum + geekblogPrivacyPolicy: https://geeklabor.de/legal-notice/#datenschutzerkl%C3%A4rung + + geekblogAnchorLeft: true diff --git a/gulpfile.js b/gulpfile.js index 2f62ef3..9040d01 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -105,6 +105,17 @@ gulp.task('favicon-check-update', function (done) { gulp.task('svg-sprite', function () { config = { + shape: { + dimension: { + maxWidth: 24, + maxHeight: 24, + attributes: false, + }, + spacing: { + padding: 0, + box: 'content' + }, + }, svg: { xmlDeclaration: false, rootAttributes: { diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml new file mode 100644 index 0000000..98d95b8 --- /dev/null +++ b/layouts/_default/list.atom.xml @@ -0,0 +1,71 @@ +{{ printf `` | safeHTML }} {{/* ref: https://validator.w3.org/feed/docs/atom.html */}} + + Hugo + {{- $title := .Site.Title -}} + {{- with .Title -}} + {{- if (not (eq . $title)) -}} + {{- $title = printf `%s on %s` . $title -}} + {{- end -}} + {{- end -}} + {{ printf `<![CDATA[%s]]>` $title | safeHTML }} + {{ with .Site.Params.GeekblogSubtitle }} + {{ printf `` . | safeHTML }} + {{ end }} + {{ $output_formats := .OutputFormats }} + {{ range $output_formats -}} + {{- $rel := (or (and (eq "atom" (.Name | lower)) "self") "alternate") -}} + {{ with $output_formats.Get .Name }} + {{ printf `` .Permalink $rel .MediaType.Type .Name | safeHTML }} + {{- end -}} + {{- end }} + {{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + {{ with .Site.Params.GeekblogAuthor -}} + {{ with index $.Site.Data.authors . }} + + {{ .name }} + {{ with .email }} + {{ . }} + {{ end -}} + + {{ end }} + {{- end }} + {{ .Permalink }} + {{- $pages := where .RegularPages "Type" "in" .Site.Params.mainSections -}} + {{- if (eq .Kind "home") -}} + {{- $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}} + {{- end -}} + {{- range $pages }} + {{ $page := . }} + + {{ printf `<![CDATA[%s]]>` .Title | safeHTML }} + + {{ .Permalink }} + {{ with .Params.authors -}} + {{- range sort . -}} + {{ $author := index $.Site.Data.authors . }} + + {{ $author.name }} + + {{- end -}} + {{- end }} + {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + {{ $desc := .Description | default "" }} + {{ $description := (cond (eq "" $desc) "" (printf "
%s
" ($desc | markdownify))) }} + {{ printf `` $description .Content | safeHTML }} + {{ with .Site.Taxonomies }} + {{ range $taxo,$_ := . }} + {{ with $page.Param $taxo }} + {{ $taxo_list := . }} + {{ with $.Site.GetPage (printf "/%s" $taxo) }} + {{ $taxonomy_page := . }} + {{ range $taxo_list }} + + {{ end }} + {{ end }} + {{ end }} + {{ end }} + {{ end }} +
+ {{ end }} +
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 7ed8a62..56f8205 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,6 +1,84 @@ {{ define "main" }} - {{ range .Paginator.Pages }} - {{ partial "list.html" . }} + {{ $pages := where .RegularPages "Type" "in" .Site.Params.mainSections }} + {{ if (eq .Kind "home") }} + {{ $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} + {{ end }} + + {{ $paginator := .Paginate $pages }} + {{ range $paginator.Pages }} +
+
+

{{ partial "title" . }}

+
+ +
+ {{ .Summary }} +
+
+ {{ if .Truncated }} + Read full post + {{ end }} +
+ +
+ + + + + + {{ $ac := 0 }} + {{ with .Params.authors }} + {{ range sort . }} + {{ $author := index $.Site.Data.authors . }} + {{ with $.Site.GetPage (printf "/authors/%s" $author.name | urlize) }} + {{ if eq $ac 0 }} + + + {{ template "post-author" dict "name" $author.name "page" . }} + + {{ else }} + {{ template "post-author" dict "name" $author.name "page" . }} + {{ end }} + {{ end }} + {{ $ac = (add $ac 1) }} + {{ end }} + {{ end }} + + {{ $tc := 0 }} + {{ with .Params.tags }} + {{ range sort . }} + {{ $name := . }} + {{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }} + {{ if eq $tc 0 }} + + + {{ template "post-tag" dict "name" $name "page" . }} + + {{ else }} + {{ template "post-tag" dict "name" $name "page" . }} + {{ end }} + {{ end }} + {{ $tc = (add $tc 1) }} + {{ end }} + {{ end }} +
+
{{ end }} {{ partial "pagination.html" . }} {{ end }} + +{{ define "post-tag" }} + +{{ end }} + +{{ define "post-author" }} + +{{ end }} diff --git a/layouts/index.html b/layouts/index.html deleted file mode 100644 index fedf7bd..0000000 --- a/layouts/index.html +++ /dev/null @@ -1,8 +0,0 @@ -{{ define "main" }} - {{ $paginator := .Paginate (where .Site.RegularPages "Type" "posts") }} - - {{ range $paginator.Pages }} - {{ partial "list.html" . }} - {{ end }} - {{ partial "pagination.html" . }} -{{ end }} diff --git a/layouts/partials/list.html b/layouts/partials/list.html deleted file mode 100644 index 42cdef6..0000000 --- a/layouts/partials/list.html +++ /dev/null @@ -1,73 +0,0 @@ -
-
-

{{ partial "title" . }}

-
- -
- {{ .Summary }} -
-
- {{ if .Truncated }} - Read full post - {{ end }} -
- -
- - - - - - {{ $ac := 0 }} - {{ with .Params.authors }} - {{ range sort . }} - {{ $author := index $.Site.Data.authors . }} - {{ with $.Site.GetPage (printf "/authors/%s" $author.name | urlize) }} - {{ if eq $ac 0 }} - - - {{ template "post-author" dict "name" $author.name "page" . }} - - {{ else }} - {{ template "post-author" dict "name" $author.name "page" . }} - {{ end }} - {{ end }} - {{ $ac = (add $ac 1) }} - {{ end }} - {{ end }} - - {{ $tc := 0 }} - {{ with .Params.tags }} - {{ range sort . }} - {{ $name := . }} - {{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }} - {{ if eq $tc 0 }} - - - {{ template "post-tag" dict "name" $name "page" . }} - - {{ else }} - {{ template "post-tag" dict "name" $name "page" . }} - {{ end }} - {{ end }} - {{ $tc = (add $tc 1) }} - {{ end }} - {{ end }} -
-
- -{{ define "post-tag" }} - -{{ end }} - -{{ define "post-author" }} - -{{ end }} diff --git a/layouts/partials/site-footer.html b/layouts/partials/site-footer.html index 8dd1562..d1aa8cf 100644 --- a/layouts/partials/site-footer.html +++ b/layouts/partials/site-footer.html @@ -1,18 +1,30 @@
-
- - Built with Hugo and - - - {{ with .Site.Params.GeekblogLegalNotice }} - - Legal Notice - - {{ end }} - {{ with .Site.Params.GeekblogPrivacyPolicy }} - - Privacy Policy - - {{ end }} +
+
+ + + Feed + + + + Contact + + {{ with .Site.Params.GeekblogLegalNotice }} + + Legal Notice + + {{ end }} + {{ with .Site.Params.GeekblogPrivacyPolicy }} + + Privacy Policy + + {{ end }} +
+
+ + Built with Hugo and + + +
diff --git a/layouts/partials/site-header.html b/layouts/partials/site-header.html index 8a3064b..482decc 100644 --- a/layouts/partials/site-header.html +++ b/layouts/partials/site-header.html @@ -5,16 +5,18 @@ {{ .Site.Title }} {{ .Site.Title }} - Subtitle to describe your blog + {{ with .Site.Params.GeekblogSubtitle }} + {{ . }} + {{ end }}