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

47 lines
1.5 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;">
<!-- 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 $year -}}<div>{{ $year }}</div>{{- end -}}
{{- if $runtime -}}<div>{{ $runtime }} min</div>{{- end -}}
{{- if $director -}}
<div>
{{- if reflect.IsSlice $director -}}
{{ delimit $director ", " }}
{{- else -}}
{{ $director }}
{{- end -}}
</div>
{{- end -}}
</div>
{{- end -}}
</div>
</div>