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

View File

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

View File

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