diff --git a/func.go b/func.go index 35e84ca..cbb8d9c 100644 --- a/func.go +++ b/func.go @@ -146,10 +146,20 @@ func htmlReplacer(input string, activePage string) string { events := getEvents() if len(events) == 0 { - output = strings.ReplaceAll(output, "!EVENTS", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/")) + output = strings.ReplaceAll(output, "!EVENTS", htmlElement("h4", "Keine Events in der nächsten Zeit!", "")) } else { + tempA, tempB := "", "" + for i, Event := range events { + if i == 24 { + break + } - output = strings.ReplaceAll(output, "!EVENTS", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/")) + tempA = htmlElement("h2", Event.title, "") + tempA += htmlElement("p", Event.description, "") + tempA += htmlElement("p", Event.date, "") + tempB += htmlElement("div", tempA, "class=\"event\"") + } + output = strings.ReplaceAll(output, "!EVENTS", tempB) } output = strings.ReplaceAll(output, "!NEWBANNER", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/"))