112 lines
3.9 KiB
HTML
112 lines
3.9 KiB
HTML
{{ define "main" }}
|
|
|
|
{{ if .Content }}
|
|
<div class="index-content {{ if .Params.framed -}}framed{{- end -}}">
|
|
{{ .Content }}
|
|
</div>
|
|
{{ end }}
|
|
|
|
<!-- Variables for collection of posts -->
|
|
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
|
|
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
|
|
|
|
{{ $PageContext := . }}
|
|
{{ if .IsHome }}
|
|
{{ $PageContext = .Site }}
|
|
{{ end }}
|
|
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
|
|
|
|
<div class="sections">
|
|
{{ range .Site.Menus.main }}
|
|
{{ if eq (first 2 .URL) "/#" }}
|
|
<section id="{{ .Identifier }}" class="posts section">
|
|
{{ if $.Site.Params.singlePageSite }}
|
|
<h1 class="section-header">{{ .Name }}<a href="#{{ .Identifier }}" class="hanchor" arialabel="Anchor">⌗</a></h1>
|
|
{{ end }}
|
|
{{ if ne .Identifier $.Site.Params.contentTypeName }}
|
|
{{ if $.Site.Params.singlePageSite }}
|
|
<div class="post">
|
|
{{ $section := path.Join "homepage" .Identifier }}
|
|
{{ with $.Site.GetPage $section }}
|
|
{{ partial "section.html" . }}
|
|
{{ end }}
|
|
</div>
|
|
{{ end }}
|
|
{{ else }}
|
|
{{ range $paginator.Pages }}
|
|
<article class="post on-list">
|
|
<h1 class="post-title">
|
|
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
|
</h1>
|
|
<div class="post-meta">
|
|
<span class="post-date">
|
|
{{ with .Params.daterange }}
|
|
{{ . }}
|
|
{{ else }}
|
|
{{ .Date.Format "01-02-2006" }}
|
|
{{ end }}
|
|
</span>
|
|
{{ with .Params.Author }}
|
|
<span class="post-author">:: {{ . }}</span>
|
|
{{ end }}
|
|
</div>
|
|
|
|
{{ if .Params.tags }}
|
|
<span class="post-tags">
|
|
{{ range .Params.tags }}
|
|
#<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
|
|
{{- . -}}
|
|
</a>
|
|
{{ end }}
|
|
</span>
|
|
{{ end }}
|
|
|
|
{{ if .Params.Cover }}
|
|
<img src="{{ .Params.Cover | absURL }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />
|
|
{{ end }}
|
|
|
|
<div class="post-content">
|
|
{{ if .Params.showFullContent }}
|
|
{{ .Content | markdownify }}
|
|
{{ else if .Description }}
|
|
{{ .Description | markdownify }}
|
|
{{ else }}
|
|
{{ if .Truncated }}
|
|
{{ .Summary | markdownify }}
|
|
{{ end }}
|
|
{{ end }}
|
|
</div>
|
|
|
|
{{ if not .Params.showFullContent }}
|
|
<div>
|
|
<a class="read-more button"
|
|
href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a>
|
|
</div>
|
|
{{ end }}
|
|
</article>
|
|
{{ end }}
|
|
{{ if $.Site.Params.singlePageSite }}
|
|
<div class="pagination">
|
|
<div class="pagination__buttons">
|
|
<span class="button previous">
|
|
<a href="{{ $.Site.Params.singlePageCollectionSeeMoreLink }}">
|
|
<span class="button__icon">→</span>
|
|
<span class="button__text">{{ $.Site.Params.singlePageCollectionSeeMoreText }}</span>
|
|
</a>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
{{ else }}
|
|
{{ partial "pagination.html" $ }} <!-- originally . instead of $ -->
|
|
{{ end }}
|
|
{{ end }}
|
|
</section>
|
|
{{ if $.Site.Params.singlePageSite }}
|
|
<hr class="section-separator">
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
</div>
|
|
|
|
{{ end }}
|