Skip to content

Commit

Permalink
simplifying cover page configuration for different layout types
Browse files Browse the repository at this point in the history
  • Loading branch information
dencold committed Aug 10, 2016
1 parent ebfa2d9 commit 61da5f4
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 6 deletions.
2 changes: 1 addition & 1 deletion layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{partial "navigation.html" .}}

<div class="site-wrapper">
{{partial "banner.html" .}}
{{partial "covers/post.html" .}}

<main id="content" class="content" role="main">

Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="site-wrapper">

{{$baseurl := .Site.BaseURL}}
{{partial "banner.html" .}}
{{partial "covers/paging.html" .}}

<main class="content" role="main">
{{$paginator := .Paginator}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<div class="site-wrapper">

{{partial "banner.html" .}}
{{partial "covers/post.html" .}}

<main class="content" role="main">
<article class="post {{ .Section }}">
Expand Down
6 changes: 3 additions & 3 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
{{$paginator := .Paginate (where .Data.Pages "Section" "!=" "author")}}

{{/*
we only show the fullscreen banner if we are on the first page
we only show the fullscreen cover if we are on the first page
(otherwise it gets very confusing for the user, who needs to scroll
in order to see more content)
*/}}
{{if eq $paginator.PageNumber 1}}
{{partial "banner_full.html" .}}
{{partial "covers/landing.html" .}}
{{else}}
{{partial "banner.html" .}}
{{partial "covers/paging.html" .}}
{{end}}

<main id="content" class="content" role="main">
Expand Down
26 changes: 26 additions & 0 deletions layouts/partials/covers/landing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{$coverImage := or .Params.image .Params.cover .Site.Params.cover}}

{{if not $coverImage}}
<header class="main-header no-cover">
{{else}}
<header class="main-header" style="background-image: url({{$coverImage}})">
{{end}}

{{partial "nav.html" .}}

<div class="vertical">
<div class="main-header-content inner">

{{partial "social.html" .}}

<h1 class="page-title">{{.Site.Title}}</h1>
<h2 class="page-description">{{.Site.Params.description}}</h2>
</div>
</div>

<a class="scroll-down icon-arrow-left" href="#content">
<span class="hidden">Scroll Down</span>
</a>

</header>

19 changes: 19 additions & 0 deletions layouts/partials/covers/paging.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{$coverImage := or .Params.image .Params.cover .Site.Params.cover}}

{{if not $coverImage}}
<header class="main-header tag-head no-cover">
{{else}}
<header class="main-header tag-head" style="background-image: url({{$coverImage}})">
{{end}}

{{partial "nav.html" .}}

<div class="vertical">
<div class="main-header-content inner">
<h1 class="page-title">{{.Title}}</h1>
{{with .Params.description}}
<h2 class="page-description">{{.}}</h2>
{{end}}
</div>
</div>
</header>
16 changes: 16 additions & 0 deletions layouts/partials/covers/post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{$coverImage := or .Params.image .Params.cover .Site.Params.cover}}

{{if not $coverImage}}
<header class="main-header tag-head no-cover">
{{else}}
<header class="main-header post-head" style="background-image: url({{$coverImage}})">
{{end}}

{{partial "nav.html" .}}

<div class="vertical">
<div class="main-header-content inner">
<h1 class="page-title">{{.Title}}</h1>
</div>
</div>
</header>

0 comments on commit 61da5f4

Please sign in to comment.