1
Fork 0

Restructure out to partials

This commit is contained in:
Jake Howard 2017-10-27 22:56:44 +01:00
parent d4cc96c7c9
commit 2f8ac87c87
Signed by: jake
GPG key ID: 57AFB45680EDD477
5 changed files with 55 additions and 33 deletions

View file

@ -0,0 +1,15 @@
{{ define "main" }}
<div id="main">
<div class="container">
{{ partial "content.html" . }}
<hr />
{{ $parent := . }}
{{ $sorted_pages := sort .Site.Pages (default "Title" .Params.sort_by) (default "asc" .Params.sort_order)}}
{{ $valid_pages := where $sorted_pages ".Parent" "!=" nil }}
{{ $valid_pages := where $valid_pages ".Params.hide_in_list" "!=" "true" }}
{{ range where $valid_pages ".Parent.UniqueID" $parent.UniqueID }}
{{ partial "list_item.html" . }}
{{ end }}
</div>
</div>
{{ end }}

View file

@ -1,26 +1,7 @@
{{ define "main" }} {{ define "main" }}
<div id="main"> <div id="main">
<div class="container"> <div class="container">
{{ if .Params.image }} {{ partial "content.html" . }}
<img class="mb-3" src="{{ .Params.image }}" style="width: 100%; max-height: 30vh"/>
{{ end }}
<h1 class="display-5">{{ .Title }}</h1>
<h5 class="my-3">{{ .Params.subtitle }}</h5>
<p>
<span class="pr-4" title='{{ .Date.Format "January 2 2006" }}'>{{ .Date.Format "2006-01-02" }}</span>
{{ range .Params.tags }}
<a href="/tags/{{ urlize . }}" class="badge badge-dark mr-2" style="font-size: 1rem">
<i class="fa fa-tag"></i> {{ . }}
</a>
{{ end }}
</p>
<hr />
<div class="content mt-3">
<div class="float-md-right ml-4">
{{ .TableOfContents }}
</div>
{{ .Content }}
</div>
</div> </div>
</div> </div>
{{ end }} {{ end }}

View file

@ -0,0 +1,23 @@
{{ if .Params.image }}
<img class="mb-3" src="{{ .Params.image }}" style="width: 100%; max-height: 30vh"/>
{{ end }}
<h1 class="display-5">{{ .Title }}</h1>
<h5 class="my-3">{{ .Params.subtitle }}</h5>
<p>
{{ if .Params.date }}
<span class="pr-4" title='{{ .Date.Format "January 2 2006" }}'>{{ .Date.Format "2006-01-02" }}</span>
{{ end }}
{{ range .Params.tags }}
<a href="/tags/{{ urlize . }}" class="badge badge-dark mr-2" style="font-size: 1rem">
<i class="fa fa-tag"></i> {{ . }}
</a>
{{ end }}
</p>
<hr />
<div class="content mt-3">
<div class="float-md-right ml-4">
{{ .TableOfContents }}
</div>
{{ .Content }}
</div>

View file

@ -0,0 +1,15 @@
<div class="media list-page-item mb-3">
{{ if .Params.image }}
<div class="d-none d-md-block align-self-center img-wrapper mr-3">
<a href="{{ .Permalink }}">
<img src="{{ .Params.image }}" alt="{{ .Title }} image" />
</a>
</div>
{{ end }}
<div class="media-body">
<a href="{{ .Permalink }}">
<h5 class="mt-0">{{ .Title }}</h5>
</a>
<p>{{ .Summary }}</p>
</div>
</div>

View file

@ -9,19 +9,7 @@
<time datetime="{{ $month }}" title='{{ dateFormat "January 2006" $month }}'>{{ dateFormat "2006-01" $month }}</time> <time datetime="{{ $month }}" title='{{ dateFormat "January 2006" $month }}'>{{ dateFormat "2006-01" $month }}</time>
</h3> </h3>
{{ range .Pages.ByDate }} {{ range .Pages.ByDate }}
<div class="media list-page-item mb-3"> {{ partial "list_item.html" . }}
<div class="d-none d-md-block align-self-center img-wrapper mr-3">
<a href="{{ .Permalink }}">
<img src="{{ .Params.image }}" alt="{{ .Title }} image" />
</a>
</div>
<div class="media-body">
<a href="{{ .Permalink }}">
<h5 class="mt-0">{{ .Title }}</h5>
</a>
<p>{{ .Summary }}</p>
</div>
</div>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>