Files
marcus-web/layouts/shortcodes/imdbposter.html
T

48 lines
1.6 KiB
HTML
Raw Normal View History

{{- $imdb := .Page.Params.imdb -}}
2025-12-24 17:14:39 -06:00
{{- $localPoster := .Page.Params.poster -}}
{{- $year := .Page.Params.year -}}
{{- $runtime := .Page.Params.runtime -}}
{{- $director := .Page.Params.director -}}
{{- $poster := "" -}}
{{- if $localPoster -}}
{{- $poster = $localPoster -}}
{{- else if $imdb -}}
{{- $poster = printf "https://img.omdbapi.com/?i=%s&apikey=d9641e70" $imdb -}}
{{- end -}}
<div style="display: flex; justify-content: flex-start; align-items: flex-start; margin-bottom: 2em;">
2025-12-24 17:14:39 -06:00
<!-- Left section: viewing details -->
<div style="flex: 1; padding-right: 20px;">
{{ .Inner | markdownify }}
</div>
2025-12-24 17:14:39 -06:00
<!-- Right section: movie poster and info -->
<div style="flex-shrink: 0; text-align: center;">
{{- if $imdb -}}
<a href="https://www.imdb.com/title/{{ $imdb }}" target="_blank">
<img src="{{ $poster }}" alt="Movie Poster" style="width: 200px;" />
</a>
2025-12-24 17:14:39 -06:00
{{- else if $poster -}}
<img src="{{ $poster }}" alt="Movie Poster" style="width: 200px;" />
{{- end -}}
{{- if or $year $runtime $director -}}
<div style="font-size: 0.85em; color: #666; margin-top: 8px;">
{{- if $director -}}
<div>
Directed by {{ if reflect.IsSlice $director }}{{ delimit $director ", " }}{{ else }}{{ $director }}{{ end }}
</div>
{{- end -}}
{{- if or $year $runtime -}}
2025-12-24 17:14:39 -06:00
<div>
{{- if $year }}{{ $year }}{{ end -}}
{{- if and $year $runtime }} · {{ end -}}
{{- if $runtime }}{{ $runtime }} min{{ end -}}
2025-12-24 17:14:39 -06:00
</div>
{{- end -}}
</div>
{{- end -}}
</div>
</div>