Used Hugo's "{{-" and "-}}" syntax to remove extra whitespace

This commit is contained in:
Steven Engler 2019-07-06 12:31:51 -04:00
parent cbe8e5e1e8
commit 423e7f6272
3 changed files with 33 additions and 33 deletions

View File

@ -1,4 +1,4 @@
{{ $themeStyleDefault := "light.css" }}
{{ $themeStyleDefault := "light.css" -}}
<!DOCTYPE html>
<html>
@ -10,9 +10,9 @@
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
<link rel="stylesheet" href="css/styles.css">
<link id="theme_css" rel="stylesheet" href="css/themes/{{ .Site.Params.ThemeStyle | default $themeStyleDefault }}">
{{ if .Site.Params.ThemeStyleSwitcher }}
{{- if .Site.Params.ThemeStyleSwitcher }}
<script src="js/theme-switcher.js"></script>
{{ end }}
{{- end }}
</head>
<body>
<input class="show-hide-menu-input" style="display:none;" autocomplete="off" type="checkbox" id="toggle-1">
@ -24,40 +24,40 @@
</div>
<div>
<div class="header-right">
{{ if .Site.Params.ThemeStyleSwitcher }}
{{- if .Site.Params.ThemeStyleSwitcher }}
<div id="change-theme-button" style="display:none;" class="clickable-header-label">
<img class="color-adapting-image" width="30" src="" onclick="toggle_theme()">
</div>
{{ end }}
{{- end }}
<label id="show-hide-menu-label" class="clickable-header-label" for="toggle-1">
<img class="color-adapting-image" width="30" src="images/hamburger.svg" alt="menu button">
</label>
</div>
<label class="overlay" for="toggle-1"></label>
{{ if .Site.Menus.main }}
{{- if .Site.Menus.main }}
<div class="dont-show">
Links:
</div>
<ul class="links">
{{ range .Site.Menus.main.ByWeight }}
{{- range .Site.Menus.main.ByWeight }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
{{- end }}
</ul>
{{ end }}
{{- end }}
</div>
</div>
</div>
<div class="body">
<div class="body-content">
{{ block "main" . }}{{ end }}
{{- block "main" . }}{{ end }}
</div>
</div>
</div>
{{ if .Site.Params.FooterText }}
{{- if .Site.Params.FooterText }}
<hr class="dont-show">
<div class="footer">
<p>{{ .Site.Params.FooterText }}</p>
</div>
{{ end }}
{{- end }}
</body>
</html>

View File

@ -4,29 +4,29 @@
<div class="title-header">
<h1>{{ .Title }}</h1>
</div>
{{ if gt (len .Sections) 0 }}
{{- if gt (len .Sections) 0 }}
<h2>Categories</h2>
<ul>
{{ range .Sections }}
{{- range .Sections }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
{{- end }}
</ul>
<h2>All Posts</h2>
{{ end }}
{{ $cs := .CurrentSection }}
{{ with $cs }}
{{ range (where .Site.RegularPages "Section" .Section) }}
{{ if .IsDescendant $cs }}
{{- end }}
{{- $cs := .CurrentSection }}
{{- with $cs }}
{{- range (where .Site.RegularPages "Section" .Section) }}
{{- if .IsDescendant $cs }}
<article class="all-list">
<div class="title-list">
<h3><a href="{{ .RelPermalink }}">{{ if .Draft }}<i>(Draft)</i> {{ end }}{{ .Title }}</a></h3>
<div class="title-list-date">
{{ if eq .Date.IsZero false }}
{{- if eq .Date.IsZero false }}
<time>{{ .Date.Format "Monday, January 2, 2006" }}</time>
{{ end }}
{{ if (and (eq .Lastmod.IsZero false) (ne .Lastmod .Date)) }}
{{- end }}
{{- if (and (eq .Lastmod.IsZero false) (ne .Lastmod .Date)) }}
(updated)
{{ end }}
{{- end }}
</div>
</div>
<div class="body-list">
@ -34,12 +34,12 @@
<p>
{{ .Summary }}
</p>
{{ if .Truncated }}
{{- if .Truncated }}
<a href="{{ .RelPermalink }}">Read More…</a>
{{ end }}
{{- end }}
</div>
</article>
{{ end }}
{{ end }}
{{ end }}
{{- end }}
{{- end }}
{{- end }}
{{ end }}

View File

@ -3,12 +3,12 @@
<div class="title-header">
<h1>{{ if .Draft }}<i>(Draft)</i> {{ end }}{{ .Title }}</h1>
<div class="title-header-date">
{{ if eq .Date.IsZero false }}
{{- if eq .Date.IsZero false }}
<time>{{ .Date.Format "Monday, January 2, 2006" }}</time>
{{ end }}
{{ if (and (eq .Lastmod.IsZero false) (ne .Lastmod .Date)) }}
{{- end }}
{{- if (and (eq .Lastmod.IsZero false) (ne .Lastmod .Date)) }}
&mdash; last updated <time>{{ .Lastmod.Format "January 2, 2006" }}</time>
{{ end }}
{{- end }}
</div>
</div>
{{ .Content }}