Code cleanup

This commit is contained in:
Hanzei 2018-06-27 02:33:38 +02:00
parent 389a69a6e7
commit ada1932097
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0
6 changed files with 21 additions and 36 deletions

View file

@ -11,21 +11,19 @@
<div class="section no-padding {{ if .Site.Params.fadeIn }} fade-in two {{ end }}">
{{ partial "nav.html" . }}
<div class="container markdown {{ if .Site.Params.fadeIn | default true }}fade-in two{{ end }} top-pad">
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
{{ .Content }}
</div>
<!-- Begin Blog container -->
<!-- Begin container -->
<div class="container">
<ul>
<!-- Ranges through content/*/*.md -->
{{ range .Data.Pages.ByPublishDate }} {{ if not (eq .Section "blog") }}
{{ range .Pages.ByPublishDate }}
<li>
<a href="{{.Permalink}}">{{.Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }} | {{.Title}}</a>
</li>
{{ end }} {{ end }}
{{ end }}
</ul>
</div>
<!-- End Blog container -->
<!-- End container -->
{{ partial "top-icon-with-hr.html" . }}
{{ partial "footer.html" . }}
</div>

View file

@ -16,7 +16,7 @@
<!-- Begin Blog container -->
<div class="container">
<ul>
{{ range .Data.Pages.ByPublishDate }}
{{ range .Pages.ByPublishDate }}
<li>
<a href="{{.Permalink}}">{{.Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }} | {{.Title}}</a>
</li>

View file

@ -11,14 +11,13 @@
<div class="section no-padding {{ if .Site.Params.fadeIn | default true }}fade-in two{{ end }}">
{{ partial "nav.html" . }}
<div class="container markdown {{ if .Site.Params.fadeIn | default true }}fade-in two{{ end }} top-pad">
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
{{ .Content }}
</div>
<!-- Begin Blog container -->
<div class="container">
{{ if .Site.Params.showLatest }}
<h2 class="title is-2 top-pad">{{ i18n "index_blog_latestPosts" . }}</h2>
{{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
{{ range first 1 .Pages.ByPublishDate.Reverse }}
<div class="summary">{{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }}
<h3 class="title is-3 strong-post-title">
<a href="{{ .RelPermalink }}">
@ -36,10 +35,8 @@
{{ end }}
<h2 class="title is-2 top-pad">{{ i18n "index_blog_allPosts" . }}</h2>
<ul>
{{ range .Data.Pages.ByPublishDate }}
{{ if eq .Section "blog" }}
{{ partial "li.html" . }}
{{ end }}
{{ range .Pages.ByPublishDate.Reverse }}
{{ partial "li.html" . }}
{{ end }}
</ul>
</div>

View file

@ -4,7 +4,7 @@
<div class="container">
{{ if .Site.Params.showLatest }}
<h2 class="title is-2 has-text-centered">{{ i18n "index_blog_latestPosts" . }}</h2>
{{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
{{ range first 1 .Pages.ByPublishDate.Reverse }}
<div class="summary">{{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }}
<h3 class="title is-3 latest-post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<div class="markdown">

View file

@ -5,12 +5,11 @@
<h2 class="title is-2 has-text-centered">
{{ .Title }}
</h2>
<div class="section is-small">
<div class="columns is-multiline">
{{ $totalProjects := (len (.Site.GetPage "section" "projects").Pages) }}
{{ $totalProjects := (len .Pages) }}
{{ $numberOfProjectsToShow := .Site.Params.numberOfProjectsToShow | default $totalProjects }}
{{ range (.Site.GetPage "section" "projects").Pages | first $numberOfProjectsToShow }}
{{ range .Pages | first $numberOfProjectsToShow }}
{{ if eq (mod $numberOfProjectsToShow 2) 0 }}
<div class="column is-half">
{{ else }}
@ -43,9 +42,8 @@
{{ end }}
</div>
<!-- End Projects container -->
<!-- Projects modals -->
{{ range (.Site.GetPage "section" "projects").Pages | first $numberOfProjectsToShow }} {{ if not .Params.external_link }}
{{ range .Pages | first $numberOfProjectsToShow }} {{ if not .Params.external_link }}
<div class="modal" id="modal{{ $card := .Title | urlize }}{{ replace $card "%" " "}}">
<div class="modal-background"></div>
<div class="modal-card">
@ -77,6 +75,5 @@
{{ partial "top-icon.html" . }}
</div>
<!-- End Projects section -->
<div class="container"><hr></div>
{{ end }}

View file

@ -16,13 +16,13 @@
<div class="container">
<div class="section is-small">
<div class="columns is-multiline">
<!-- Ranges through content/projects/*.md -->
{{ range .Data.Pages }}
{{ if eq (mod (len (.Site.GetPage "section" "projects").Pages) 2) 0 }}
{{ $numberOfPages := len .Pages}}
{{ range .Pages }}
{{ if eq (mod $numberOfPages 2) 0 }}
<div class="column is-half">
{{ else }}
<div class="column is-one-third">
{{ end }}
{{ end }}
<div class="card">
<div class="card-image">
<figure class="image is-3by2">
@ -42,17 +42,10 @@
</div>
</div>
</div>
<div class="container has-text-centered top-pad">
<hr>
<a href="#top">
<i class="fa fa-arrow-up"></i>
</a>
<hr>
</div>
{{ partial "top-icon-with-hr.html" . }}
{{ partial "footer.html" . }}
</div><!-- End fade in two -->
</div><!-- End parent section -->
</div>
<!-- End fade in two -->
</div>
<!-- End parent section -->
</body>