Clean up templates a whole bunch by making single page layout, a true single page layout
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{{ define "main" }}
|
||||
|
||||
|
||||
{{ if .Content }}
|
||||
<div class="index-content {{ if .Params.framed -}}framed{{- end -}}">
|
||||
{{ .Content }}
|
||||
@@ -14,98 +15,50 @@
|
||||
{{ if .IsHome }}
|
||||
{{ $PageContext = .Site }}
|
||||
{{ end }}
|
||||
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
|
||||
|
||||
<div class="sections">
|
||||
{{ range .Site.Menus.main }}
|
||||
{{ if eq (first 2 .URL) "/#" }}
|
||||
|
||||
{{ if $.Site.Params.singlePageSite }}
|
||||
<div class="sections">
|
||||
{{ range .Site.Menus.main }}
|
||||
<section id="{{ .Identifier }}" class="posts section">
|
||||
{{ if $.Site.Params.singlePageSite }}
|
||||
{{ if eq (first 2 .URL) "/#" }}
|
||||
<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 }}
|
||||
<div class="post">
|
||||
{{ $section := path.Join "homepage" .Identifier }}
|
||||
{{ with $.Site.GetPage $section }}
|
||||
{{ partial "section.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
{{ range $paginator.Pages.ByDate.Reverse }}
|
||||
<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>
|
||||
<h1 class="section-header">{{ .Name }}<a href="{{ .URL }}" class="hanchor" arialabel="Anchor">⌗</a></h1>
|
||||
{{ $thisSectionsPages := where $PageContext.RegularPages "Type" .Identifier }}
|
||||
{{ range first $.Site.Params.homepagePaginateCount $thisSectionsPages.ByDate.Reverse }}
|
||||
{{ partial "collection.html" . }}
|
||||
{{ 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 class="pagination">
|
||||
<div class="pagination__buttons">
|
||||
<span class="button previous">
|
||||
<a href="{{ .URL }}">
|
||||
<span class="button__icon">→</span>
|
||||
<span class="button__text">See more {{ .Name | pluralize }}</span>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
{{ else }}
|
||||
{{ partial "pagination.html" $ }} <!-- originally . instead of $ -->
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ if $.Site.Params.singlePageSite }}
|
||||
<hr class="section-separator">
|
||||
{{ end }}
|
||||
<hr class="section-separator">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="posts">
|
||||
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
|
||||
{{ range $paginator.Pages.ByDate.Reverse }}
|
||||
{{ partial "collection.html" . }}
|
||||
{{ end }}
|
||||
{{ partial "pagination.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user