diff --git a/assets/sass/_theme/blocks/posts.sass b/assets/sass/_theme/blocks/posts.sass index fc6ebdf4d5d61d999bd7209ea99827bdc89501af..085690565313f985025077a0cedcda26bbee7720 100644 --- a/assets/sass/_theme/blocks/posts.sass +++ b/assets/sass/_theme/blocks/posts.sass @@ -163,3 +163,18 @@ margin-top: 0 article:first-child margin-top: 0 + &--alternate .alternate + @include media-breakpoint-up(desktop) + margin-left: calc(#{$grid-gutter} * 2) + margin-right: calc(#{$grid-gutter} * 2) + .post + width: col(4, 10) + &.right + margin-left: auto + &:not(:first-child) + &.portrait + margin-top: -30% + &.square + margin-top: -15% + .post .media img + aspect-ratio: unset \ No newline at end of file diff --git a/layouts/partials/blocks/templates/posts/alternate.html b/layouts/partials/blocks/templates/posts/alternate.html index b30b6952147104437054bd890a1207047a239f5f..2173bfba1d3bf85b2105783cbeb49f6539f75b20 100644 --- a/layouts/partials/blocks/templates/posts/alternate.html +++ b/layouts/partials/blocks/templates/posts/alternate.html @@ -1,9 +1,11 @@ <div class="alternate"> - {{ range $post := .posts -}} + {{ range $i, $post := .posts -}} {{ with site.GetPage (printf "/posts/%s" $post) }} {{ partial "posts/post.html" (dict "post" . "heading" "h3" + "index" $i + "alternate" true ) }} {{ end }} {{ end }} diff --git a/layouts/partials/footer/debug.html b/layouts/partials/footer/debug.html index bb2359ce3f2b72ccb554ac33362ed622f1486996..b6863c633e6e46b16b0e9a836549f972a8c6d79f 100644 --- a/layouts/partials/footer/debug.html +++ b/layouts/partials/footer/debug.html @@ -17,7 +17,7 @@ <div><span>0 (12px) </span></div> <div><span>1 (24px) </span></div> <div><span>2 (48px) </span></div> - <div><span>3 (64px) </span></div> + <div><span>3 (50px) </span></div> <div><span>4 (128px) </span></div> <div><span>5 (256px) </span></div> </div> @@ -25,8 +25,8 @@ <div class="d-cross"></div> <style> :root { - --d-grid-margin: 64px; - --d-grid-sm-margin: 44px; + --d-grid-margin: 50px; + --d-grid-sm-margin: 30px; } .d-grid { bottom: 0; diff --git a/layouts/partials/posts/post.html b/layouts/partials/posts/post.html index 37da4637923dd4d7af3bd3e8952be9a36bdfa229..3c4fbf0f442aa26658578ed1e8696c710401ed10 100644 --- a/layouts/partials/posts/post.html +++ b/layouts/partials/posts/post.html @@ -1,12 +1,20 @@ {{ $post := .post }} +{{- $direction := "" -}} {{ $heading := .heading | default "h2" }} {{ $heading_tag := (dict "open" ((printf "<%s itemprop='headline'>" $heading) | safeHTML) "close" ((printf "</%s>" $heading) | safeHTML) ) }} +{{ $index := .index}} +{{ $alternate := .alternate}} {{ with $post }} -<article class="post" itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting"> + +{{ if .Params.image }} + {{- $direction = partial "GetImageDirection" .Params.image -}} +{{ end }} + +<article class='post {{ if $alternate }}{{ $direction }} {{if not (modBool $index 2)}}left{{ else}}right{{end}}{{end}}' itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting"> <div class="post-content"> {{- $title := partial "PrepareHTML" .Title -}}