diff options
author | tosi29 <tosi16@gmail.com> | 2019-05-26 07:20:53 +0300 |
---|---|---|
committer | tosi29 <tosi16@gmail.com> | 2019-05-26 07:20:53 +0300 |
commit | 11b710b2de162a6a7ca2275af567d7e611a522b4 (patch) | |
tree | 0da549fc6d4a79452413aefa3014ef4a2aac2218 | |
parent | b949ba0e3f7d458496e621124247fd26712334b6 (diff) |
Show "post" type only in homepage
-rw-r--r-- | layouts/index.html | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/layouts/index.html b/layouts/index.html index 87e79dc..bc181ea 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,5 +1,6 @@ {{ define "main" }} +{{ $paginator := .Paginate ( where .Pages "Type" "post" ) 10 }} <main aria-role="main"> <header class="homepage-header"> <h1>{{.Title}}</h1> @@ -13,29 +14,29 @@ </div> <div> <!-- Note that .Pages is the same as .Site.RegularPages on the homepage template. --> - {{ range .Paginator.Pages }} + {{ range $paginator.Pages }} {{ .Render "summary"}} {{ end }} </div> -{{ if gt .Paginator.TotalPages 1 }} -{{ $current := .Paginator.PageNumber }} +{{ if gt $paginator.TotalPages 1 }} +{{ $current := $paginator.PageNumber }} <div class="nav-links"> <ul class="pagination"> - {{ with .Paginator.First }} + {{ with $paginator.First }} <a href="{{ .URL }}" aria-label="First"><span aria-hidden="true">«</span></a> {{ end }} - <a href="{{ if .Paginator.HasPrev }}{{ .Paginator.Prev.URL }}{{ end }}" aria-label="Previous"><span aria-hidden="true">Previous Page</span></a> - {{ range .Paginator.Pagers }} + <a href="{{ if $paginator.HasPrev }}{{ $paginator.Prev.URL }}{{ end }}" aria-label="Previous"><span aria-hidden="true">Previous Page</span></a> + {{ range $paginator.Pagers }} {{ if eq $current .PageNumber }} <span href="{{ .URL }}">{{ .PageNumber }}</a> {{ else }} <a href="{{ .URL }}">{{ .PageNumber }}</a> {{ end }} {{ end }} - <a href="{{ if .Paginator.HasNext }}{{ .Paginator.Next.URL }}{{ end }}" aria-label="Next"><span aria-hidden="true">Next Page</span></a> - {{ with .Paginator.Last }} + <a href="{{ if $paginator.HasNext }}{{ $paginator.Next.URL }}{{ end }}" aria-label="Next"><span aria-hidden="true">Next Page</span></a> + {{ with $paginator.Last }} <a href="{{ .URL }}" aria-label="Last"><span aria-hidden="true">»</span></a> {{ end }} </ul> |