Use indentation inside templating blocks for better readability

This commit is contained in:
2021-11-22 02:21:15 -06:00
parent e1e211a42a
commit ead88d5e16
24 changed files with 310 additions and 326 deletions

View File

@ -9,22 +9,22 @@
</div>
{{ if not .IsHome }}
{{ partial "breadcrumb.html" . }}
{{ partial "breadcrumb.html" . }}
{{ end }}
<div class="content">
{{ block "main" . }}
{{ .Content }}
{{ .Content }}
{{ end }}
</div>
{{ with .Site.Copyright }}
<footer>
<hr>
<small>
{{ . | safeHTML }}
</small>
</footer>
<footer>
<hr>
<small>
{{ . | safeHTML }}
</small>
</footer>
{{ end }}
</body>

View File

@ -1,37 +1,35 @@
{{ define "main" }}
<h1>
{{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }}
{{ .Title | markdownify }}
<span class="rss-link">
{{ with .OutputFormats.Get "rss" }}
<a href="{{ .Permalink }}" target="_blank" rel="noopener">{{ partial "icon.html" "rss-feed" }}</a>
{{ end }}
</span>
</h1>
<div class="list-page-content">
{{ with .Sections }}
<div class="sections">
{{ range . }}
{{ .Render "summary/section" }}
{{ end }}
</div>
{{ end }}
<div class="page-list">
<ul>
{{ range .Paginator.Pages }}
<li>{{ .Render "summary/post" }}</li>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
<h1>
{{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }}
{{ .Title | markdownify }}
<span class="rss-link">
{{ with .OutputFormats.Get "rss" }}
<a href="{{ .Permalink }}" target="_blank" rel="noopener">{{ partial "icon.html" "rss-feed" }}</a>
{{ end }}
</ul>
</span>
</h1>
<div class="list-page-content">
{{ with .Sections }}
<div class="sections">
{{ range . }}
{{ .Render "summary/section" }}
{{ end }}
</div>
{{ end }}
<div class="page-list">
<ul>
{{ range .Paginator.Pages }}
<li>{{ .Render "summary/post" }}</li>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</ul>
</div>
</div>
</div>
{{ partial "pagination.html" . }}
{{ partial "pagination.html" . }}
{{ end }}

View File

@ -1,106 +1,102 @@
{{ define "main" }}
<div class="post-title">
<h1>
{{ .Title | markdownify }}
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h1>
</div>
<div class="post-title">
<h1>
{{ .Title | markdownify }}
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h1>
</div>
{{ partial "post-metadata/full.html" . }}
{{ partial "post-metadata/full.html" . }}
{{ with (.GetTerms "series") }}
{{ $series := slice }}
{{ range . }}
{{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
{{ end }}
<div class="series-box">
{{ partial "icon.html" "info" }}
{{ if gt (len $series) 1 }}
This post is part of multiple series:
{{ else }}
This post is part of a series:
{{ end }}
{{ delimit $series ", " }}
</div>
{{ end }}
{{ if .Params.Toc }}
<div class="table-of-contents">
<details>
<summary>{{ i18n "table_of_contents" }}</summary>
{{ .TableOfContents }}
</details>
</div>
<div class="table-of-contents print">
{{ i18n "table_of_contents" }}
{{ .TableOfContents }}
</div>
{{ end }}
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" . "border" true) }}
</div>
{{ end }}
{{ .Content }}
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<div class="see-also">
<h2>{{ i18n "see_also" }}</h2>
<ul>
{{ with (.GetTerms "series") }}
{{ $series := slice }}
{{ range . }}
<li>
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
</li>
{{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
{{ end }}
</ul>
</div>
{{ end }}
{{ if or .NextInSection .PrevInSection }}
<div class="prevnext">
{{ with .NextInSection }}
<a class="prev" href="{{ .Permalink }}">
<div class="prev-caption">
&larr; {{ i18n "newer_post" }}
<div class="series-box">
{{ partial "icon.html" "info" }}
{{ if gt (len $series) 1 }}
This post is part of multiple series:
{{ else }}
This post is part of a series:
{{ end }}
{{ delimit $series ", " }}
</div>
<div class="prev-post">
{{ .Title | markdownify }}
</div>
</a>
{{ else }}
<div class="prev"></div>
{{ end }}
{{ with .PrevInSection }}
<a class="next" href="{{ .Permalink }}">
<div class="next-caption">
{{ i18n "older_post" }} &rarr;
{{ if .Params.Toc }}
<div class="table-of-contents">
<details>
<summary>{{ i18n "table_of_contents" }}</summary>
{{ .TableOfContents }}
</details>
</div>
<div class="next-post">
{{ .Title | markdownify }}
<div class="table-of-contents print">
{{ i18n "table_of_contents" }}
{{ .TableOfContents }}
</div>
</a>
{{ else }}
<div class="next"></div>
{{ end }}
</div>
{{ end }}
{{ if .Params.comments }}
<div class="comments">
{{ partial "comments.html" . }}
</div>
{{ end }}
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" . "border" true) }}
</div>
{{ end }}
{{ .Content }}
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<div class="see-also">
<h2>{{ i18n "see_also" }}</h2>
<ul>
{{ range . }}
<li>
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{ if or .NextInSection .PrevInSection }}
<div class="prevnext">
{{ with .NextInSection }}
<a class="prev" href="{{ .Permalink }}">
<div class="prev-caption">
&larr; {{ i18n "newer_post" }}
</div>
<div class="prev-post">
{{ .Title | markdownify }}
</div>
</a>
{{ else }}
<div class="prev"></div>
{{ end }}
{{ with .PrevInSection }}
<a class="next" href="{{ .Permalink }}">
<div class="next-caption">
{{ i18n "older_post" }} &rarr;
</div>
<div class="next-post">
{{ .Title | markdownify }}
</div>
</a>
{{ else }}
<div class="next"></div>
{{ end }}
</div>
{{ end }}
{{ if .Params.comments }}
<div class="comments">
{{ partial "comments.html" . }}
</div>
{{ end }}
{{ end }}

View File

@ -8,9 +8,9 @@
{{ partial "post-metadata/short.html" . }}
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
{{ partial "figure.html" (dict "src" . "border" true) }}
</div>
<div class="post-media">
{{ partial "figure.html" (dict "src" . "border" true) }}
</div>
{{ end }}
<div class="post-description">

View File

@ -9,14 +9,14 @@
{{ partial "post-meta-item/translations.html" . }}
{{ if ne .Site.Params.readingtime false }}
<span class="post-meta-item">
{{ partial "icon.html" "clock" }}
{{ $readingtime := 0 }}
{{ range .Data.Pages }}
{{ $readingtime = (add $readingtime .ReadingTime) }}
{{ end }}
{{ i18n "readingtime" $readingtime }}
</span>
<span class="post-meta-item">
{{ partial "icon.html" "clock" }}
{{ $readingtime := 0 }}
{{ range .Data.Pages }}
{{ $readingtime = (add $readingtime .ReadingTime) }}
{{ end }}
{{ i18n "readingtime" $readingtime }}
</span>
{{ end }}
{{ partial "post-meta-item/viewsource.html" . }}
@ -29,7 +29,7 @@
<div class="series-pages">
<ul>
{{ range .Data.Pages.Reverse }}
<li>{{ .Render "summary/post" }}</li>
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
</div>