Skip to content

Commit

Permalink
Minor layout tweaks (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR authored Jan 22, 2024
1 parent b944ff1 commit 2c130e8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/layouts/_default/home.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ define "main" }}
<div class="posts-container mx-auto my-5">
<div class="posts">
{{ $paginator := .Paginate (where site.RegularPages "Type" "posts") }}
{{ $paginator := .Paginate (where site.RegularPages "Type" "posts") -}}
{{- range $i, $page := $paginator.Pages -}}
{{- /* Don't lazyload the first video in each page */ -}}
{{- $lazyload := cond (eq $i 0) false true -}}
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/_default/videos.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ define "main" }}
{{ $postsWithVideos := where (where site.RegularPages "Type" "posts") ".Params.video" "!=" nil -}}
{{- range $index, $post := $postsWithVideos }}
{{- range $index, $post := $postsWithVideos -}}
{{- if eq $index 0 -}}
<div class="row my-5">
{{- end }}
Expand Down
4 changes: 3 additions & 1 deletion src/layouts/partials/social.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
<meta name="twitter:creator" content="@{{ $author_twitter | default .Site.Params.twitter }}">

{{ template "_internal/opengraph.html" . -}}

{{- /* Manually add `og:image`'s dimensions since Hugo's internal shortcode doesn't do it */ -}}
{{ with (imageConfig (path.Join "src/static" (index $.Site.Params.images 0))) -}}
{{- $socialImage := path.Join "src/static" (index $.Site.Params.images 0) -}}
{{- with imageConfig $socialImage -}}
<meta property="og:image:width" content="{{ .Width }}">
<meta property="og:image:height" content="{{ .Height }}">
{{- end }}
9 changes: 8 additions & 1 deletion src/layouts/partials/video.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
{{- $video_start := .context.Params.video_start -}}

<div class="ratio ratio-16x9">
<iframe {{ if eq $lazyload true }}class="lazy" data-src{{ else }}src{{ end }}="https://www.youtube-nocookie.com/embed/{{ $video }}?rel=0{{ with $video_start }}&amp;start={{ . }}{{ end }}" title="YouTube Video" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" width="760" height="570" allowfullscreen></iframe>
<iframe
{{ if eq $lazyload true }}class="lazy" data-src{{ else }}src{{ end }}="https://www.youtube-nocookie.com/embed/{{ $video }}?rel=0{{ with $video_start }}&amp;start={{ . }}{{ end }}"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
title="YouTube Video"
width="760"
height="570">
</iframe>
</div>

0 comments on commit 2c130e8

Please sign in to comment.