print: DRY partials #230

This commit is contained in:
Sören Weber 2022-04-11 23:04:49 +02:00
parent e8226f4d0e
commit 31c9c77c5e
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
14 changed files with 69 additions and 98 deletions

View file

@ -1,4 +1,2 @@
{{- .Scratch.Set "relearnOutputFormat" "HTML" }} {{- .Scratch.Set "relearnOutputFormat" "HTML" }}
{{- partial "header.html" . }} {{- partial "_list.html" . }}
{{- partial "content-screen.html" . }}
{{- partial "footer.html" . }}

View file

@ -1,4 +1,2 @@
{{- .Scratch.Set "relearnOutputFormat" "PRINT" }} {{- .Scratch.Set "relearnOutputFormat" "PRINT" }}
{{- partial "header.html" . }} {{- partial "_list.html" . }}
{{- partial "content-print.html" . }}
{{- partial "footer.html" . }}

View file

@ -1,4 +1,2 @@
{{- .Scratch.Set "relearnOutputFormat" "HTML" }} {{- .Scratch.Set "relearnOutputFormat" "HTML" }}
{{- partial "header.html" . }} {{- partial "_single.html" . }}
{{- partial "content-screen.html" . }}
{{- partial "footer.html" . }}

View file

@ -1,4 +1,2 @@
{{- .Scratch.Set "relearnOutputFormat" "PRINT" }} {{- .Scratch.Set "relearnOutputFormat" "PRINT" }}
{{- partial "header.html" . }} {{- partial "_single.html" . }}
{{- partial "content-print.html" . }}
{{- partial "footer.html" . }}

View file

@ -1,23 +1,2 @@
{{- .Scratch.Set "relearnOutputFormat" "HTML" }} {{- .Scratch.Set "relearnOutputFormat" "HTML" }}
{{- partial "header.html" . }} {{- partial "_taxonomy.html" . }}
<article>
<h1>{{ if eq .Kind "term" }}{{ .Data.Singular | humanize }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Title }}</h1>
<ul>
{{- range .Data.Terms.Alphabetical }}
{{- if and .Page.Title (or (ne (.Page.Scratch.Get "relearnIsHiddenStem") true) (ne .Page.Site.Params.disableTagHiddenPages true) ) }}
<li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a> ({{ len .Pages }})</li>
{{- end }}
{{- else }}
{{- range sort .Pages "Title" }}
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{- end }}
{{- end }}
{{- end }}
</ul>
<footer class="footline">
</footer>
</article>
{{- partial "footer.html" . }}

View file

@ -1,23 +1,2 @@
{{- .Scratch.Set "relearnOutputFormat" "PRINT" }} {{- .Scratch.Set "relearnOutputFormat" "PRINT" }}
{{- partial "header.html" . }} {{- partial "_taxonomy.html" . }}
<article>
<h1>{{ if eq .Kind "term" }}{{ .Data.Singular | humanize }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Title }}</h1>
<ul>
{{- range .Data.Terms.Alphabetical }}
{{- if and .Page.Title (or (ne (.Page.Scratch.Get "relearnIsHiddenStem") true) (ne .Page.Site.Params.disableTagHiddenPages true) ) }}
<li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a> ({{ len .Pages }})</li>
{{- end }}
{{- else }}
{{- range sort .Pages "Title" }}
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{- end }}
{{- end }}
{{- end }}
</ul>
<footer class="footline">
</footer>
</article>
{{- partial "footer.html" . }}

View file

@ -1,22 +1,2 @@
{{- .Scratch.Set "relearnOutputFormat" "HTML" }} {{- .Scratch.Set "relearnOutputFormat" "HTML" }}
{{- partial "header.html" . }} {{- partial "_index.html" . }}
{{- if .Site.Home.Content }}
{{- partial "content-screen.html" .Site.Home }}
{{- else }}
<article>
<h1>Customize your own home page</h1>
<p>
The site is working. Don't forget to customize this page with your own. You typically have 3 choices :
</p>
<ul>
<li><b>1.</b> Create an _index.md document in <b>content</b> folder and fill it with Markdown content</li>
<li><b>2.</b> Create an <b>index.html</b> file in the <b>static</b> folder and fill the file with HTML content</li>
<li><b>3.</b> Configure your server to automatically redirect home page to one your documentation page</li>
</ul>
<footer class="footline">
</footer>
</article>
{{- end }}
{{- partial "footer.html" . }}

View file

@ -1,22 +1,2 @@
{{- .Scratch.Set "relearnOutputFormat" "PRINT" }} {{- .Scratch.Set "relearnOutputFormat" "PRINT" }}
{{- partial "header.html" . }} {{- partial "_index.html" . }}
{{- if .Site.Home.Content }}
{{- partial "content-print.html" .Site.Home }}
{{- else }}
<article>
<h1>Customize your own home page</h1>
<p>
The site is working. Don't forget to customize this page with your own. You typically have 3 choices :
</p>
<ul>
<li><b>1.</b> Create an _index.md document in <b>content</b> folder and fill it with Markdown content</li>
<li><b>2.</b> Create an <b>index.html</b> file in the <b>static</b> folder and fill the file with HTML content</li>
<li><b>3.</b> Configure your server to automatically redirect home page to one your documentation page</li>
</ul>
<footer class="footline">
</footer>
</article>
{{- end }}
{{- partial "footer.html" . }}

View file

@ -0,0 +1,25 @@
{{- partial "header.html" . }}
{{- if .Site.Home.Content }}
{{- if eq (.Scratch.Get "relearnOutputFormat") "PRINT" }}
{{- partial "body.print.html" .Site.Home }}
{{- else }}
{{- partial "body.html" .Site.Home }}
{{- end }}
{{- else }}
<article>
<h1>Customize your own home page</h1>
<p>
The site is working. Don't forget to customize this page with your own. You typically have 3 choices :
</p>
<ul>
<li><b>1.</b> Create an _index.md document in <b>content</b> folder and fill it with Markdown content</li>
<li><b>2.</b> Create an <b>index.html</b> file in the <b>static</b> folder and fill the file with HTML content</li>
<li><b>3.</b> Configure your server to automatically redirect home page to one your documentation page</li>
</ul>
<footer class="footline">
</footer>
</article>
{{- end }}
{{- partial "footer.html" . }}

View file

@ -0,0 +1,7 @@
{{- partial "header.html" . }}
{{- if eq (.Scratch.Get "relearnOutputFormat") "PRINT" }}
{{- partial "body.print.html" . }}
{{- else }}
{{- partial "body.html" . }}
{{- end }}
{{- partial "footer.html" . }}

View file

@ -0,0 +1,7 @@
{{- partial "header.html" . }}
{{- if eq (.Scratch.Get "relearnOutputFormat") "PRINT" }}
{{- partial "body.print.html" . }}
{{- else }}
{{- partial "body.html" . }}
{{- end }}
{{- partial "footer.html" . }}

View file

@ -0,0 +1,22 @@
{{- partial "header.html" . }}
<article>
<h1>{{ if eq .Kind "term" }}{{ .Data.Singular | humanize }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Title }}</h1>
<ul>
{{- range .Data.Terms.Alphabetical }}
{{- if and .Page.Title (or (ne (.Page.Scratch.Get "relearnIsHiddenStem") true) (ne .Page.Site.Params.disableTagHiddenPages true) ) }}
<li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a> ({{ len .Pages }})</li>
{{- end }}
{{- else }}
{{- range sort .Pages "Title" }}
{{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{- end }}
{{- end }}
{{- end }}
</ul>
<footer class="footline">
</footer>
</article>
{{- partial "footer.html" . }}