Restructure out to partials
This commit is contained in:
parent
d4cc96c7c9
commit
2f8ac87c87
5 changed files with 55 additions and 33 deletions
15
layouts/_default/list.html
Normal file
15
layouts/_default/list.html
Normal 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 }}
|
|
@ -1,26 +1,7 @@
|
|||
{{ define "main" }}
|
||||
<div id="main">
|
||||
<div class="container">
|
||||
{{ 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>
|
||||
<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>
|
||||
{{ partial "content.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
23
layouts/partials/content.html
Normal file
23
layouts/partials/content.html
Normal 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>
|
15
layouts/partials/list_item.html
Normal file
15
layouts/partials/list_item.html
Normal 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>
|
|
@ -9,19 +9,7 @@
|
|||
<time datetime="{{ $month }}" title='{{ dateFormat "January 2006" $month }}'>{{ dateFormat "2006-01" $month }}</time>
|
||||
</h3>
|
||||
{{ range .Pages.ByDate }}
|
||||
<div class="media list-page-item mb-3">
|
||||
<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>
|
||||
{{ partial "list_item.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue