Skip to content

Commit

Permalink
Add possibility to exclude section content
Browse files Browse the repository at this point in the history
  • Loading branch information
cmahnke committed Feb 16, 2024
1 parent d113dd7 commit 0148318
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 30 deletions.
5 changes: 5 additions & 0 deletions content/applications/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
title: "Job applications"
metaPage: true
displayinlist: false
archive: false
news: false
sectionContent: false
---

{{< bill-nye >}}

[Bill Nye](https://en.wikipedia.org/wiki/Bill_Nye) is a well known [science communicator](https://en.wikipedia.org/wiki/Science_communication) from USA, he got famous in this role during the 90ies.

This role also made him a popular person for illustrating [internet memes](https://en.wikipedia.org/wiki/Internet_meme), even if they are not used for science communication.

This example is intended to draw attention to memes as a method of communicating science and culture, the message has certainly got through 😉
5 changes: 4 additions & 1 deletion content/applications/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
title: "Bewerbungen"
metaPage: true
displayinlist: false
archive: false
news: false
sectionContent: false
---

{{< bill-nye >}}
Expand All @@ -10,4 +13,4 @@ displayinlist: false

Durch diese Rolle ist er auch eine beliebte Person zur Illustration von [Internet Memes](https://de.wikipedia.org/wiki/Meme_(Kulturph%C3%A4nomen)), auch wenn diese nicht der Wissenschaftskommunikation dienen.

Dieses Beispiel soll auf Meme's als Methode der Wissenschafts- und Kulturvermittlung hinweisen.
Dieses Beispiel soll auf Meme's als Methode der Wissenschafts- und Kulturvermittlung hinweisen, die Nachricht ist sicher angekommen 😉
73 changes: 44 additions & 29 deletions layouts/partials/section-page.html
Original file line number Diff line number Diff line change
@@ -1,50 +1,65 @@
{{- $debug := partialCached "partials/functions/debug/enabled.html" . -}}

{{- $head := .CurrentSection -}}
{{- $pages := slice -}}
{{- if .IsHome -}}
{{- $pages = where .Site.Pages "Section" "home" -}}
{{- $pages = where .Site.Pages "Section" "home" -}}
{{- else -}}
{{- $pages = .Pages -}}
{{- $pages = .Pages -}}
{{/* TODO: Add a filter for subsections
{{- if .Params. -}}

{{- else -}}
{{- $pages = where .Pages "Section" .CurrentSection -}}
{{- end -}}
*/}}
{{- end -}}

{{- $sections := newScratch -}}
{{- $sections.Set "sections" slice -}}

{{- partial "section-heading.html" . -}}

{{- range $i, $section := $pages.ByWeight -}}
{{- $class := "odd" -}}
{{- if modBool $i 2 -}}
{{- $class = "even" -}}
{{- end -}}

{{- $nav := path.Base .Permalink -}}
{{- $nav = replaceRE "^/$" "root" $nav -}}
{{- $class = printf "section-%s %s section-%d" $nav $class $i -}}
{{- if and (not (isset .Params "sectioncontent")) (not .Params.sectioncontent) -}}
{{- range $i, $section := $pages.ByWeight -}}
{{- $class := "odd" -}}
{{- if modBool $i 2 -}}
{{- $class = "even" -}}
{{- end -}}

{{- $id := substr (md5 $class) 0 8 -}}
{{- $nav := path.Base .Permalink -}}
{{- $nav = replaceRE "^/$" "root" $nav -}}
{{- $class = printf "section-%s %s section-%d" $nav $class $i -}}

{{- partial "partials/check-section-includes.html" . -}}
{{- $id := substr (md5 $class) 0 8 -}}

{{- if ne .Content "" -}}
<a name="{{ $nav }}" class="anchor" /></a>
<div id="{{ $nav }}" data-section="{{ $nav }}" class="{{ $class }} section-content">
{{- partial "partials/check-section-includes.html" . -}}

<h1 class="section-content-title">
{{- .Title -}}
</h1>
<div class="section-content-body">
{{- .Content -}}
</div>
{{- if ne .Content "" -}}
<a name="{{ $nav }}" class="anchor" /></a>
<div id="{{ $nav }}" data-section="{{ $nav }}" class="{{ $class }} section-content">

{{- if eq .Kind "section" -}}
<div class="section-content-subsection">
{{- partial "subsection.html" . -}}
<h1 class="section-content-title">
{{- .Title -}}
</h1>
<div class="section-content-body">
{{- .Content -}}
</div>
{{- end -}}

</div>
{{- $sections.Add "sections" (dict "nav" $nav "title" .Title) -}}
{{- end -}}
{{- if eq .Kind "section" -}}
<div class="section-content-subsection">
{{- partial "subsection.html" . -}}
</div>
{{- end -}}

</div>
{{- $sections.Add "sections" (dict "nav" $nav "title" .Title) -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- if $debug -}}
{{- warnf "[partials/section-page.html] Excluding sub pages for section %s" .File.Dir -}}
{{- end -}}
{{- end -}}

{{- if ne ($sections.Get "sections" ) nil -}}
Expand Down

0 comments on commit 0148318

Please sign in to comment.