Skip to content

Commit

Permalink
Rename variables (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR authored Mar 25, 2024
1 parent 67c3094 commit d91b2ea
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
23 changes: 12 additions & 11 deletions src/layouts/partials/author-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
{{- $author := .context.Page.Params.author -}}
{{- $date := .context.Date -}}
<div class="d-flex align-items-center mb-4 text-muted author-info">
{{ $author_url := urls.JoinPath "https://github.com" $author -}}
<a class="d-flex align-items-center text-muted text-decoration-none" href="{{ $author_url }}" target="_blank" rel="noopener">
{{ $avatar_width := 32 -}}
{{- $avatar_width_2x := mul $avatar_width 2 -}}
{{- $img_url := printf "%s%s%d" $author_url ".png?size=" $avatar_width -}}
{{- $img_url_2x := printf "%s%s%d" $author_url ".png?size=" $avatar_width_2x -}}
{{ $authorUrl := urls.JoinPath "https://github.com" $author -}}
<a class="d-flex align-items-center text-muted text-decoration-none" href="{{ $authorUrl }}" target="_blank" rel="noopener">
{{ $avatarWidth := 32 -}}
{{- $avatarWidth2x := mul $avatarWidth 2 -}}
{{- $avatarHeight := $avatarWidth -}}
{{- $imgUrl := printf "%s%s%d" $authorUrl ".png?size=" $avatarWidth -}}
{{- $imgUrl2x := printf "%s%s%d" $authorUrl ".png?size=" $avatarWidth2x -}}
<img class="mb-0 me-2 rounded-2"
srcset="{{ $img_url }}, {{ $img_url_2x }} 2x"
src="{{ $img_url }}"
srcset="{{ $imgUrl }}, {{ $imgUrl2x }} 2x"
src="{{ $imgUrl }}"
alt=""
width="{{ $avatar_width }}"
height="{{ $avatar_width }}"
{{ if eq .lazyload true }}loading="lazy"{{ end }}>
{{ if eq .lazyload true }}loading="lazy"{{ end }}
width="{{ $avatarWidth }}"
height="{{ $avatarHeight }}">
<span>@{{ $author }}</span>
</a>
<span class="d-flex align-items-center ms-3" title="{{ $date | dateFormat "02 Jan 06 15:04 MST" }}">
Expand Down
10 changes: 5 additions & 5 deletions src/layouts/partials/hero.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="masthead py-5">
<div class="mb-4 text-center text-lg-start">
<a class="flex-shrink-0 mb-lg-3 link-dark text-decoration-none" href="/" aria-label="Bootstrap">
{{ $img_path := "/assets/brand/bootstrap-logo-shadow.png" -}}
{{- $img_path_2x := "/assets/brand/[email protected]" -}}
{{- with (imageConfig (path.Join "/src/static" $img_path)) -}}
{{ $imgPath := "/assets/brand/bootstrap-logo-shadow.png" -}}
{{- $imgPath2x := "/assets/brand/[email protected]" -}}
{{- with (imageConfig (path.Join "/src/static" $imgPath)) -}}
<img class="bd-booticon d-block mx-auto mb-3 mx-lg-0"
srcset="{{ $img_path }}, {{ $img_path_2x }} 2x"
src="{{ $img_path }}"
srcset="{{ $imgPath }}, {{ $imgPath2x }} 2x"
src="{{ $imgPath }}"
alt="Bootstrap"
width="{{ .Width }}"
height="{{ .Height }}">
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/partials/social.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{{- $author := "" -}}
{{- $author_twitter := "" -}}
{{- $authorTwitter := "" -}}

{{- if isset .Page.Params "author" -}}
{{- $author = (index .Site.Data.authors .Page.Params.author).name -}}
{{- $author_twitter = (index .Site.Data.authors .Params.author).twitter -}}
{{- $authorTwitter = (index .Site.Data.authors .Params.author).twitter -}}
{{- end -}}

<meta name="author" content="{{ $author | default .Site.Params.author }}">

{{ template "_internal/twitter_cards.html" . -}}
{{- /* Manually add `twitter:creator` since Hugo's internal shortcode has some issues */ -}}
<meta name="twitter:creator" content="@{{ $author_twitter | default .Site.Params.twitter }}">
<meta name="twitter:creator" content="@{{ $authorTwitter | default .Site.Params.twitter }}">

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

Expand Down
4 changes: 2 additions & 2 deletions src/layouts/partials/video.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

{{- $lazyload := .lazyload -}}
{{- $video := .context.Params.video -}}
{{- $video_start := .context.Params.video_start -}}
{{- $videoStart := .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 }}"
{{ if eq $lazyload true }}class="lazy" data-src{{ else }}src{{ end }}="https://www.youtube-nocookie.com/embed/{{ $video }}?rel=0{{ with $videoStart }}&amp;start={{ . }}{{ end }}"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
title="YouTube Video"
Expand Down

0 comments on commit d91b2ea

Please sign in to comment.