small fixes

This commit is contained in:
teldra 2022-06-07 13:36:28 +02:00
parent c5739db3ff
commit 9322ea68b7
14 changed files with 191 additions and 51 deletions

View File

@ -9,3 +9,12 @@ copyright = "bunteshaus.de"
defaultContentLanguageInSubdir = true
defaultContentLanguage = "de"
[related]
threshold = 10
includeNewer = true
toLower = true
[[related.indices]]
name = "tags"
weight = 90

View File

@ -26,10 +26,12 @@ mainMenu = ['about','news','events']
searchSections = ['news']
# how long stays a featrued article on frontpage as featured (in weeks)
featured_expire = "28"
featured_expire = "13"
placeholder = "/images/no_article_pic.png"
items_per_list = 5
# data for your imprint and contact page
[imprintdata]
tel = "(+) 49 5141 907 927"

View File

@ -1,6 +1,6 @@
---
title: "Über uns"
layout: "article_list"
layout: "gen_list"
---
Wir sind das Buntehaus, ein [soziokulturelles](/bunteshaus/soziokultur) Zentrum in Celle.
Wir leben vom mitmachen und so.

View File

@ -4,4 +4,12 @@
margin-left: auto;
margin-right: auto;
}
.twolists {
display: flex; flex-wrap: wrap; justify-content: space-around;
div {
display: flex;
flex-direction: column;
width: 45%;
}
}
}

View File

@ -89,8 +89,52 @@ section, article, .article_footer, .sidebar {
flex-direction: column;
}
.two-lists {
display: flex; flex-wrap: wrap; justify-content: space-around;
.twolists {
}
.gen_list {
a { text-decoration: none;
margin-bottom: 5rem;
&:hover {
.img {
height: 180px;
background-size: 110% auto;
background-position: top;
}
.img-only {
height: 360px;
background-size: 110% auto;
background-position: top;
}
}
}
img {
width: 100%;
}
h3 {
margin-top: 0rem;
}
section {
margin-right: 1rem;
margin-left: 1rem;
}
.img {
width: 100%;
height: 140px;
background-size: 100% auto;
background-position: top;
transition: all .3s ease-in-out;
background-repeat: no-repeat;
}
.img-only {
width: 100%;
height: 360px;
background-size: 100% auto;
background-position: top;
transition: all .2s ease-in-out;
background-repeat: no-repeat;
}
}
article {

View File

@ -106,4 +106,5 @@ article {
.index_section { max-width: 42%; }
}
}
}

View File

@ -15,11 +15,11 @@
{{- $paginator := "" -}}
{{- $partial := .Layout -}}
{{- $paginate := true -}}
{{- if eq .Layout "article_list" -}}
{{- if eq .Layout "gen_list" -}}
{{ if eq .Section "events" }}
{{- $pages = where $pages ".Params.when" "ne" nil -}}
{{ else if eq .Type "about" }}
{{- $pages = where $pages ".Params.about" "=" true -}}
{{- $pages = (where $pages ".Params.about" "=" true) -}}
{{ else if eq .Section "news" }}
{{- $pages = .Data.Pages -}}
{{ else if eq .Section "featured" }}
@ -30,7 +30,7 @@
{{ else }}
{{ if eq .Kind "term" }}
{{- $pages = .Data.Pages -}}
{{ $partial = "article_list" }}
{{ $partial = "gen_list" }}
{{ else if eq .Kind "taxonomy" }}
{{ $paginate = false }}
{{- $pages = .Data.Terms.ByCount -}}
@ -40,7 +40,7 @@
{{ $partial = string (printf "layout/%s" $partial) }}
{{ partial $partial (dict "context" . "pages" $pages "amount" "5" "content" .Content "type" .Type "paginate" $paginate) }}
{{ partial $partial (dict "context" . "pages" $pages "content" .Content "type" .Type "paginate" $paginate) }}
{{ end }}
{{ define "sidebar" }}

View File

@ -17,6 +17,7 @@
{{ $partial = printf "layout/%s" .Layout }}
{{ end }}
<article>
{{ partial $partial (dict "context" . "pic" $pic "content" .Content "partial_before" $partial_before "type" "article") }}
</article>
{{ end }}
@ -44,6 +45,13 @@
{{ end }}
{{ end }}
{{ $related := .Site.RegularPages.RelatedIndices . "tags" | first 5 }}
{{ if $related }}
<h3 class="align_menu">Related</h3>
{{ range $related }}
<div class="align_menu"><a href="{{ .Permalink }}">{{ .Title }}</a></div>
{{ end }}
{{ end }}
</aside>
{{ end }}
{{ end }}

View File

@ -4,13 +4,9 @@
{{ $featured := where (where (where $all ".Params.featured" "=" true) "Type" "in" .Site.Params.searchSections) ".Params.Lastmod" "gt" (now.AddDate 0 0 $days) }}
{{ $featured = where (where $all ".Params.featured" "=" true) "Type" "in" .Site.Params.searchSections }}
{{ $featured = $all | intersect $featured }}
{{ $posts := $all | complement $featured }}
{{ if ne .Content "" }}
{{ partial "snippets/content" (dict "content" .Content) }}
{{ end }}
{{ $news := "news" }}
{{ if i18n $news }}
{{ $news = i18n $news }}
@ -19,14 +15,14 @@
{{ if i18n $feat }}
{{ $feat = i18n $feat }}
{{ end }}
<div class="two-lists">
{{ if gt (len $featured) 1 }}
{{ partial "layout/article_list" (dict "context" . "pages" $featured "amount" "1" "title" $feat "type" "index") }}
{{ end }}
{{ if gt (len $posts) 1 }}
{{ partial "layout/article_list" (dict "context" . "pages" $posts "amount" "3" "title" $news "type" "index") }}
{{ end }}
{{ if ne .Content "" }}
{{ partial "snippets/content" (dict "content" .Content) }}
{{ end }}
<div class="twolists">
{{ partial "layout/gen_list" (dict "context" . "pages" $featured "title" $feat )}}
{{ partial "layout/gen_list" (dict "context" . "pages" $posts "title" $news "limit" "5" )}}
</div>
{{ end }}

View File

@ -0,0 +1,63 @@
{{ $p := .pages }}
{{ if and (.limit) (not .paginate) }}
{{ $p = first .limit .pages }}
{{ end }}
{{ $paginator := .pages }}
{{ if .paginate }}
{{ $paginator = .context.Paginate $p }}
{{ $p = $paginator.Pages }}
{{ end }}
{{ if or .content (and (.paginate) (.content) (eq $paginator.PageNumber 1)) }}
{{ partial "snippets/content" (dict "content" .context.Content) }}
{{ end }}
{{ if $p }}
<div class="gen_list">
{{ if .title }}<h2>{{ .title }}</h2>{{ end }}
{{ range $p }}
{{ $banner := slice }}
{{ $image := slice }}
{{ $images := slice }}
{{ if .Resources.GetMatch "banner*" }}
{{ $banner = slice (.Resources.GetMatch "banner*") }}
{{ end }}
{{ if .Resources.ByType "image" }}
{{ $image = .Resources.ByType "image" }}
{{ end }}
{{ $images = complement $banner $image }}
{{ $image = (index (complement $banner $image) 0) }}
{{ $banner = (index $banner 0) }}
<a href="{{ .Permalink }}">
<section>
<h3>
{{ .Title }}
</h3>
{{ with .Resources.GetMatch $banner }}
<div class="img" style="background-image: url({{ .Permalink }})">
</div>
{{ end }}
{{ if .Description }}
{{ .Description }}
{{ else if .Summary }}
<p>{{ .Summary }}</p>
{{ else if .Content }}
{{ .Content }}
{{ else if $image }}
{{ $i := (.Resources.GetMatch $image).Permalink }}
<div class="img-only" style="background-image: url({{ $i }})">
</div>
{{ end }}
</section>
</a>
{{ end }}
{{ if .paginate }}
{{ partial "snippets/paginator" (dict "paginator" $paginator) }}
{{ end }}
</div>
{{ end }}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -11,37 +11,46 @@ function check_checkboxes(name) {
}
}
function typeInTextarea(newText, el = document.getElementById('content')) {
const [start, end] = [el.selectionStart, el.selectionEnd];
el.setRangeText(newText, start, end);
}
function button(x) {
if (x == "url") {
let url = prompt("Please enter URL", "https://wikipedia.org");
let desc = prompt("Description", "The free Encyclopedia");
var out = "[" + desc + "](" + url + ") ";
}
if (x == "headline") {
let headline = prompt("Headline", "Act One");
var out = "##" + headline + "\n\n";
}
if (x == "pic") {
let desc = prompt("Description", "Wikipedia logo");
let pic = prompt("Please enter URL or Number", "https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png");
var out = "![" + desc + "](" + pic + ") ";
}
if (x == "bold") {
let bold = prompt("Bold", "");
var out = "_" + bold + "_ ";
}
if (x == "paragraph") {
var out = "\n\n";
}
if (x == "newline") {
var out = " \n";
}
if (x == "more") {
var out = "\n\n<!--more-->\n\n";
}
if (out != null) {
document.getElementById('content').innerHTML += out;
}
const id = document.getElementById('content');
if (x == "url") {
let url = prompt("Please enter URL", "https://wikipedia.org");
let desc = prompt("Description", "The free Encyclopedia");
var out = "[" + desc + "](" + url + ") ";
}
if (x == "headline") {
let headline = prompt("Headline", "Act One");
var out = "\n## " + headline + "\n\n";
}
if (x == "pic") {
let desc = prompt("Description", "Wikipedia logo");
let pic = prompt("Please enter URL or Number", "https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png");
var out = "![" + desc + "](" + pic + ") ";
}
if (x == "bold") {
let bold = prompt("Bold", "");
var out = "\*\*" + bold + "\*\* ";
}
if (x == "paragraph") {
var out = "\n\n";
}
if (x == "newline") {
var out = " \n";
}
if (x == "more") {
var out = "\n<!--more-->\n\n";
}
if (out != null) {
typeInTextarea(out);
const end = id.value.length;
id.setSelectionRange(end, end);
id.focus();
}
}
function testor(input) {
@ -216,7 +225,7 @@ function showInput(e) {
}
}
const textarea = document.getElementById('result');
var end = textarea.value.length;
var end = textarea.length;
textarea.focus();
}