diff options
author | Curtis Timson <curt@live.co.uk> | 2018-02-25 13:22:38 +0300 |
---|---|---|
committer | Curtis Timson <curt@live.co.uk> | 2018-02-25 13:22:38 +0300 |
commit | c9ed8307cef558b42b721dee646b1ab5a2da8e0a (patch) | |
tree | 8d43fd89c4131278ff54093ae5ca0f7c9af782d2 /layouts | |
parent | 260318a730508b3496fdd9ee594c27ab99bfacef (diff) |
:sparkles: Add featured post
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/index.html | 44 | ||||
-rw-r--r-- | layouts/partials/posts/featured.html | 21 |
2 files changed, 37 insertions, 28 deletions
diff --git a/layouts/index.html b/layouts/index.html index 83abec6..9331617 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,12 +1,18 @@ {{ partial "htmlhead" . }} <body class="is-loading"> - {{ $posts := .Paginate (where .Data.Pages "Type" .Site.Params.Posts.foldername) 6 }} + {{ $posts := where .Data.Pages "Type" .Site.Params.Posts.foldername }} + {{ $firstPost := first 1 $posts }} + {{ $postsPaging := .Paginate (after 1 ($posts)) 6 }} + + {{ range $firstPost }} + {{ .Title }} + {{ end }} <!-- Wrapper --> <div id="wrapper" class="fade-in"> - {{ if eq $posts.PageNumber 1 }} + {{ if eq $postsPaging.PageNumber 1 }} {{ partial "intro.html" . }} {{ end }} @@ -16,26 +22,26 @@ <!-- Main --> <div id="main"> - <!-- {{ partial "posts/featured.html" . }} --> + {{ partial "posts/featured.html" (dict "firstpost" $firstPost) }} - {{ partial "posts/list.html" (dict "posts" $posts) }} + {{ partial "posts/list.html" (dict "posts" $postsPaging) }} <!-- Footer --> - <footer> - <div class="pagination"> - {{ if $posts.HasPrev }} - <a href="{{ .Site.BaseURL }}{{ $posts.Prev.URL }}" class="previous">Prev</a> - {{ end }} - {{ range $posts.Pagers }} - {{ if lt .PageNumber 10 }} - <a href="{{ $.Site.BaseURL }}{{ .URL }}" class="page{{ if eq .PageNumber $posts.PageNumber }} active{{ end }}">{{ .PageNumber }}</a> - {{ end }} - {{ end }} - {{ if $posts.HasNext }} - <a href="{{ .Site.BaseURL }}{{ $posts.Next.URL }}" class="next">Next</a> - {{ end }} - </div> - </footer> + <footer> + <div class="pagination"> + {{ if $postsPaging.HasPrev }} + <a href="{{ .Site.BaseURL }}{{ $postsPaging.Prev.URL }}" class="previous">Prev</a> + {{ end }} + {{ range $postsPaging.Pagers }} + {{ if lt .PageNumber 10 }} + <a href="{{ $.Site.BaseURL }}{{ .URL }}" class="page{{ if eq .PageNumber $postsPaging.PageNumber }} active{{ end }}">{{ .PageNumber }}</a> + {{ end }} + {{ end }} + {{ if $postsPaging.HasNext }} + <a href="{{ .Site.BaseURL }}{{ $postsPaging.Next.URL }}" class="next">Next</a> + {{ end }} + </div> + </footer> </div> diff --git a/layouts/partials/posts/featured.html b/layouts/partials/posts/featured.html index 911f880..99bd113 100644 --- a/layouts/partials/posts/featured.html +++ b/layouts/partials/posts/featured.html @@ -1,15 +1,18 @@ <!-- Featured Post --> +{{ range .firstpost }} <article class="post featured"> <header class="major"> - <span class="date">April 25, 2017</span> - <h2><a href="#">And this is a<br /> - massive headline</a></h2> - <p>Aenean ornare velit lacus varius enim ullamcorper proin aliquam<br /> - facilisis ante sed etiam magna interdum congue. Lorem ipsum dolor<br /> - amet nullam sed etiam veroeros.</p> + {{ if .Date }} + <span class="date">{{ .Date.Format "January 2, 2006" }}</span> + {{ end }} + <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2> + <p>{{ .Description }}</p> </header> - <a href="#" class="image main"><img src="images/pic01.jpg" alt="" /></a> + {{ if .Params.image }} + <a href="{{ .Permalink }}" class="image main"><img src="{{ .Site.BaseURL }}{{ .Params.image }}" alt="" /></a> + {{ end }} <ul class="actions"> - <li><a href="#" class="button big">Full Story</a></li> + <li><a href="{{ .Permalink }}" class="button big">{{ .Site.Data.post.linktext }}</a></li> </ul> -</article>
\ No newline at end of file +</article> +{{ end }}
\ No newline at end of file |