small fixes and better atomfeed, which is now standard

This commit is contained in:
teldra 2022-06-24 17:04:47 +02:00
parent 914dac712a
commit 036b44f698
7 changed files with 87 additions and 24 deletions

View File

@ -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;
}

View File

@ -41,7 +41,7 @@ other = "Inhalte"
other = "Kategorien"
[category]
other = "Kategorien"
other = "Kategorie"
[tags]
other = "Tags"

View File

@ -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 -}}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ with .Title }} - {{ if i18n "category" }}{{ i18n "category" }}{{ else }}{{ "Category" }}{{ end -}}: {{.}}{{ end }}{{ end }}</title>
<link href="{{ .Permalink }}index.xml" rel="self"/>
<link href="{{ .Permalink }}"/>{{ if not .Date.IsZero }}
<updated>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>{{ end }}

View File

@ -0,0 +1,39 @@
{{ $pages := .Data.Pages }}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ with .Title }} - {{ if i18n "tag" }}{{ i18n "tag" }}{{ else }}{{ "Tag" }}{{ end -}}: {{.}}{{ end }}{{ end }}</title>
<link href="{{ .Permalink }}index.xml" rel="self"/>
<link href="{{ .Permalink }}"/>{{ if not .Date.IsZero }}
<updated>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>{{ end }}
<id>{{ .Permalink }}</id>{{ with .Site.Author.name }}
<author>
<name>{{.}}</name>{{ with $.Site.Author.email }}
<email>{{.}}</email>{{end}}
</author>{{end}}
<generator>Hugo -- gohugo.io</generator>{{ range $pages.ByLastmod.Reverse }}
<entry>
{{ `<title type="html"><![CDATA[` | safeHTML }}{{ .Title }}]]></title>
<link href="{{ .Permalink }}"/>
<id>{{ .Permalink }}</id>{{ with $.Site.Author.name }}
<author>
<name>{{.}}</name>
</author>{{end}}
<published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
{{ if .Content }}
{{ `<content type="html"><![CDATA[` | safeHTML }}
{{ .Content }}
{{ $c := .Content }}
{{ $alink := .Permalink }}
{{ range .Resources.ByType "image" }}
{{ if and (not (in $c .Name)) (not (in .Name "banner")) }}
<a href="{{ $alink }}" class="article_image no_underline"> <img loading="lazy" src="{{ .Permalink }}" alt="{{ .Name }}" width=780 height="520" /><br> {{ .Name }} </a>
{{ end }}
{{ end }}
]]></content>
{{ end }}
</entry>{{ end }}
</feed>

View File

@ -43,16 +43,10 @@
{{ if eq site.Params.files true }}<a href="{{- "files" | absLangURL -}}">{{ if i18n "files" }}{{ i18n "files" }}{{ else }}{{ "Files" }}{{ end }}</a>{{ end }}
{{ if eq site.Params.tools true }}<a href="{{- "tools" | absLangURL -}}">{{ if i18n "tools" }}{{ i18n "tools" }}{{ else }}{{ "Tools" }}{{ end }}</a>{{ end }}
{{ if eq site.Params.rss true }}
{{- if or (in .Site.Params.mainMenu .Section) -}}
{{- with .OutputFormats.Get "rss" -}}
{{- if .Permalink -}}
{{- printf `<a href="%s">` .Permalink | safeHTML -}}
{{- end -}}
RSS
{{- if .Permalink -}}
</a>
{{- end -}}
{{- end -}}
{{- if or .IsHome (in .Site.Params.mainMenu .Section) (eq .Kind "term") (eq .Section "recurrent") -}}
{{- printf `<a href="%s">` "atom.xml" | safeHTML -}}
Feed
</a>
{{ end }}
{{ end }}
{{ if eq site.Params.sourcecode true }}<a href="https://schlomp.space/Bunteshaus/bunteshaus.de">Sourcecode</a>{{ end }}

View File

@ -1,4 +1,6 @@
<noscript><p><b>Bitte aktiviere Javascript, sonst funktioniert der Generator nicht.</b></p></noscript>
<div class="generator">
{{ partial "tools/generator/form" (dict "context" . "form" 0) }}
</div>
<script defer src="{{ "/js/visibleIf.js" | urlize | relURL }}"></script>
<script defer src="{{ "/js/generator.js" | urlize | relURL }}"></script>

View File

@ -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 + "]<br>";
}
if (ntags) {
display.innerHTML += "tags: \[" + ntags + "]<br>";
if (alltags) {
display.innerHTML += "tags: \[" + alltags + "]<br>";
}
if (covid) {
display.innerHTML += "covid: \"" + covid + "\"<br>";