refactor: remove Vibrant.js (#1236)
* refactor: migrate image color extraction from client-side JavaScript to server-side Hugo. * fix: check if image exists before accessing .Resource
This commit is contained in:
@@ -8,7 +8,16 @@
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="article-details">
|
||||
<div class="article-details"
|
||||
{{- if and $image $image.Resource -}}
|
||||
{{- $colors := $image.Resource.Colors -}}
|
||||
{{- if $colors -}}
|
||||
{{- $vibrant := index $colors 0 -}}
|
||||
{{- $darkMuted := index $colors 1 | default $vibrant -}}
|
||||
style="background: linear-gradient(0deg, {{ $darkMuted }}80 0%, {{ $vibrant }}C0 100%);"
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
>
|
||||
<h2 class="article-title">
|
||||
{{- .context.Title -}}
|
||||
</h2>
|
||||
|
||||
Reference in New Issue
Block a user