Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor layout tweaks #418

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>