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

48 lines
1.6 KiB
HTML

{{- $imdb := .Page.Params.imdb -}}
{{- $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;">
<!-- Left section: viewing details -->
<div style="flex: 1; padding-right: 20px;">
{{ .Inner | markdownify }}
</div>
<!-- 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>
{{- 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 -}}
<div>
{{- if $year }}{{ $year }}{{ end -}}
{{- if and $year $runtime }} · {{ end -}}
{{- if $runtime }}{{ $runtime }} min{{ end -}}
</div>
{{- end -}}
</div>
{{- end -}}
</div>
</div>