From 036b44f698475702dc0aa086cfeec7fad4b8cbec Mon Sep 17 00:00:00 2001 From: teldra Date: Fri, 24 Jun 2022 17:04:47 +0200 Subject: [PATCH] small fixes and better atomfeed, which is now standard --- themes/buha/assets/scss/generator.scss | 7 +++- themes/buha/i18n/de.toml | 2 +- themes/buha/layouts/_default/list.atom.xml | 20 +++++----- themes/buha/layouts/_default/term.atom.xml | 39 +++++++++++++++++++ .../layouts/partials/snippets/footer.html | 14 ++----- themes/buha/layouts/shortcodes/generator.html | 2 + themes/buha/static/js/generator.js | 27 ++++++++++++- 7 files changed, 87 insertions(+), 24 deletions(-) create mode 100644 themes/buha/layouts/_default/term.atom.xml diff --git a/themes/buha/assets/scss/generator.scss b/themes/buha/assets/scss/generator.scss index 0117b23..8f8cf35 100644 --- a/themes/buha/assets/scss/generator.scss +++ b/themes/buha/assets/scss/generator.scss @@ -11,12 +11,15 @@ fieldset { } #result { - white-space: pre; display: none; background: var(--background-alt); + white-space: pre; display: flex; background: var(--background-alt); padding: 1rem 0 1rem 1rem; margin-top: 1rem; -webkit-user-select: all; user-select: all; margin-bottom: 1rem; + word-wrap: break-word; + overflow-wrap: break-word; + max-width: 100vw; } form { @@ -29,7 +32,7 @@ form { padding: .5em; } -.generator { +p { a { text-decoration: underline; } diff --git a/themes/buha/i18n/de.toml b/themes/buha/i18n/de.toml index ea0ce61..84c369e 100644 --- a/themes/buha/i18n/de.toml +++ b/themes/buha/i18n/de.toml @@ -41,7 +41,7 @@ other = "Inhalte" other = "Kategorien" [category] -other = "Kategorien" +other = "Kategorie" [tags] other = "Tags" diff --git a/themes/buha/layouts/_default/list.atom.xml b/themes/buha/layouts/_default/list.atom.xml index 629455d..7b5b5ec 100644 --- a/themes/buha/layouts/_default/list.atom.xml +++ b/themes/buha/layouts/_default/list.atom.xml @@ -1,17 +1,19 @@ -{{- $pctx := . -}} -{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} -{{- $pages := slice -}} -{{- if or $.IsHome $.IsSection -}} -{{- $pages = $pctx.RegularPages -}} -{{- else -}} -{{- $pages = $pctx.Pages -}} -{{- end -}} +{{- $pages := where .Site.RegularPages "Section" "in" .Site.Params.searchSections -}} +{{ if eq .Section "events" }} + {{- $pages = where $pages ".Params.when" "ne" nil -}} +{{ else if eq .Section "recurrent" }} + {{- $pages = where $pages ".Params.recurrent" "ne" nil -}} +{{ else if eq .Section "featured" }} + {{- $pages = where $pages ".Params.featured" "ne" nil -}} +{{ else if eq .Section "about" }} + {{- $pages = where $pages ".Params.about" "ne" nil -}} +{{ end }} {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} {{- end -}} - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ with .Title }} - {{ if i18n "category" }}{{ i18n "category" }}{{ else }}{{ "Category" }}{{ end -}}: {{.}}{{ end }}{{ end }} {{ if not .Date.IsZero }} {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}{{ end }} diff --git a/themes/buha/layouts/_default/term.atom.xml b/themes/buha/layouts/_default/term.atom.xml new file mode 100644 index 0000000..d1dbed2 --- /dev/null +++ b/themes/buha/layouts/_default/term.atom.xml @@ -0,0 +1,39 @@ +{{ $pages := .Data.Pages }} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ with .Title }} - {{ if i18n "tag" }}{{ i18n "tag" }}{{ else }}{{ "Tag" }}{{ end -}}: {{.}}{{ end }}{{ end }} + + {{ if not .Date.IsZero }} + {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}{{ end }} + {{ .Permalink }}{{ with .Site.Author.name }} + + {{.}}{{ with $.Site.Author.email }} + {{.}}{{end}} + {{end}} + Hugo -- gohugo.io{{ range $pages.ByLastmod.Reverse }} + + {{ `<![CDATA[` | safeHTML }}{{ .Title }}]]> + + {{ .Permalink }}{{ with $.Site.Author.name }} + + {{.}} + {{end}} + {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + {{ if .Content }} + {{ ` {{ .Name }}
{{ .Name }} + {{ end }} + {{ end }} + ]]>
+ {{ end }} +
{{ end }} +
diff --git a/themes/buha/layouts/partials/snippets/footer.html b/themes/buha/layouts/partials/snippets/footer.html index 8ce7a60..6794e12 100644 --- a/themes/buha/layouts/partials/snippets/footer.html +++ b/themes/buha/layouts/partials/snippets/footer.html @@ -43,16 +43,10 @@ {{ if eq site.Params.files true }}{{ if i18n "files" }}{{ i18n "files" }}{{ else }}{{ "Files" }}{{ end }}{{ end }} {{ if eq site.Params.tools true }}{{ if i18n "tools" }}{{ i18n "tools" }}{{ else }}{{ "Tools" }}{{ end }}{{ end }} {{ if eq site.Params.rss true }} - {{- if or (in .Site.Params.mainMenu .Section) -}} - {{- with .OutputFormats.Get "rss" -}} - {{- if .Permalink -}} - {{- printf `` .Permalink | safeHTML -}} - {{- end -}} - RSS - {{- if .Permalink -}} - - {{- end -}} - {{- end -}} + {{- if or .IsHome (in .Site.Params.mainMenu .Section) (eq .Kind "term") (eq .Section "recurrent") -}} + {{- printf `` "atom.xml" | safeHTML -}} + Feed + {{ end }} {{ end }} {{ if eq site.Params.sourcecode true }}Sourcecode{{ end }} diff --git a/themes/buha/layouts/shortcodes/generator.html b/themes/buha/layouts/shortcodes/generator.html index 45d01b4..aa116d0 100644 --- a/themes/buha/layouts/shortcodes/generator.html +++ b/themes/buha/layouts/shortcodes/generator.html @@ -1,4 +1,6 @@ +
{{ partial "tools/generator/form" (dict "context" . "form" 0) }} +
diff --git a/themes/buha/static/js/generator.js b/themes/buha/static/js/generator.js index 29e672a..d6602d4 100644 --- a/themes/buha/static/js/generator.js +++ b/themes/buha/static/js/generator.js @@ -202,6 +202,29 @@ function showInput(e) { } + if (nnews) { + if (alltags) { + var alltags = alltags + "," + nnews; + } else { + var alltags = nnews; + } + } + if (nevents) { + if (alltags) { + var alltags = alltags + "," + nevents; + } else { + var alltags = nevents; + } + } + if (ntags) { + if (alltags) { + var alltags = alltags + "," + ntags; + } else { + var alltags = ntags; + } + } + + if (newfoundations != '""') { @@ -259,8 +282,8 @@ function showInput(e) { display.innerHTML += "foundations: \[" + nfoundations + "]
"; } - if (ntags) { - display.innerHTML += "tags: \[" + ntags + "]
"; + if (alltags) { + display.innerHTML += "tags: \[" + alltags + "]
"; } if (covid) { display.innerHTML += "covid: \"" + covid + "\"
";