Skip to content

Commit

Permalink
print: enable print for pages with _build options matcornic#522
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed May 17, 2023
1 parent 754b5c8 commit f38878f
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 59 deletions.
4 changes: 2 additions & 2 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ disableHugoGeneratorInject = true

[[languages.en.menu.shortcuts]]
name = "<i class='fas fa-fw fa-camera'></i> Showcases"
url = "more/showcase/"
url = "showcase/"
weight = 11

[[languages.en.menu.shortcuts]]
Expand Down Expand Up @@ -140,7 +140,7 @@ disableHugoGeneratorInject = true

[[languages.pir.menu.shortcuts]]
name = "<i class='fas fa-fw fa-camera'></i> Showcases"
url = "more/showcase/"
url = "showcase/"
weight = 11

[[languages.pir.menu.shortcuts]]
Expand Down
6 changes: 3 additions & 3 deletions exampleSite/content/cont/menushortcuts.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ weight = 10

[[menu.shortcuts]]
name = "<i class='fas fa-fw fa-camera'></i> Showcases"
url = "more/showcase/"
url = "showcase/"
weight = 11

[[menu.shortcuts]]
Expand Down Expand Up @@ -75,7 +75,7 @@ Example from the current website:

[[languages.en.menu.shortcuts]]
name = "<i class='fas fa-fw fa-camera'></i> Showcases"
url = "more/showcase/"
url = "showcase/"
weight = 11

[[languages.en.menu.shortcuts]]
Expand Down Expand Up @@ -109,7 +109,7 @@ Example from the current website:

[[languages.pir.menu.shortcuts]]
name = "<i class='fas fa-fw fa-camera'></i> Showcases"
url = "more/showcase/"
url = "showcase/"
weight = 11

[[languages.pir.menu.shortcuts]]
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/more/credits/_index.en.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
+++
disableToc = true
title = "Credits"
+++

Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/more/credits/_index.pir.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
+++
disableToc = true
title = "Crrredits"
+++
{{< piratify >}}
4 changes: 0 additions & 4 deletions exampleSite/content/more/showcase/_index.pir.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
+++
title = "Showcase"
[_build]
render = "always"
list = "never"
publishResources = true
+++

## [GoboLinux Wiki](https://wiki.gobolinux.org/) by NEONsys.org
Expand All @@ -10,6 +14,6 @@ title = "Showcase"

![BITS image](bits-train.png?width=60pc&classes=shadow)

## [Pamasol Electrics](https://pamasol.github.io/de/) by Pamasol – Swiss Aerosol Solutions
## [Pamasol Electrics](https://pamasol.github.io/de/) by Pamasol

![Pamasol Electrics](pamasol-electrics-portal.png?width=60pc&classes=shadow)
8 changes: 8 additions & 0 deletions exampleSite/content/showcase/_index.pir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
+++
title = "Showcase"
[_build]
render = "always"
list = "never"
publishResources = true
+++
{{< piratify >}}
File renamed without changes
69 changes: 22 additions & 47 deletions layouts/partials/nested-article.hugo
Original file line number Diff line number Diff line change
Expand Up @@ -3,82 +3,57 @@
{{- $page.Page.Store.Set (printf "%sIsNested" $outputFormat) true }}
{{- with $page }}
{{- $currentNode := . }}
{{- $isActive := .IsHome }}
{{- $isShortcut := false }}
{{- with .Site.Menus.shortcuts }}
{{- range sort . "Weight" }}
{{- $shortcut := . }}
{{- $shortcutPage := $page.Site.GetPage (printf "%s" $shortcut.URL ) }}
{{- if and $shortcutPage (eq $shortcutPage.RelPermalink $page.RelPermalink) }}
{{- $isShortcut = true }}
{{- end }}
{{- end }}
{{- end }}
{{- $pages := .Site.Home.Pages }}
{{- $pages := .Pages }}
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- if $isShortcut }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- else }}
{{- if $isActive }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- if $pages }}
<section>
<h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
{{- end }}
{{- end }}
{{- if eq $currentOrdersectionsby "title" }}
{{- range $pages.ByTitle }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat "isActive" $isActive }}
{{- end }}
{{- else }}
{{- range $pages.ByWeight }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat "isActive" $isActive }}
{{- end }}
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- if $pages }}
<section>
<h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
{{- end }}
{{- if eq $currentOrdersectionsby "title" }}
{{- range $pages.ByTitle }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- end }}
{{- if $isActive }}
{{- if $pages }}
</section>
{{- end }}
{{- else }}
{{- range $pages.ByWeight }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- end }}
{{- end }}
{{- if $pages }}
</section>
{{- end }}
{{- end }}
{{- define "section-tree-print" }}
{{- $currentNode := .currentnode }}
{{- $outputFormat := .outputFormat }}
{{- $isActive := .isActive }}
{{- $currentFileRelPermalink := .currentnode.RelPermalink }}
{{- with .sect }}
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $isActive = or $isSelf $isActive }}
{{- $pages := .Pages }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
{{- if $hidden }}
{{- else }}
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- if $isActive }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- if $pages }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- if $pages }}
<section>
<h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
{{- end }}
{{- end }}
{{- if eq $currentOrdersectionsby "title" }}
{{- range $pages.ByTitle }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat "isActive" $isActive }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- end }}
{{- else }}
{{- range $pages.ByWeight }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat "isActive" $isActive }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- end }}
{{- end }}
{{- if $isActive }}
{{- if $pages }}
{{- if $pages }}
</section>
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand All @@ -93,4 +68,4 @@
{{- $currentNode.Page.Store.Set "nestedHasMermaid" (or ($currentNode.Page.Store.Get "nestedHasMermaid") (.Page.Store.Get "hasMermaid")) }}
{{- $currentNode.Page.Store.Set "nestedHasOpenapi" (or ($currentNode.Page.Store.Get "nestedHasOpenapi") (.Page.Store.Get "hasOpenapi")) }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit f38878f

Please sign in to comment.