Check the length of the plaintext .LinkTitle when deciding whether it's short enough to include in the page summary

Something about the Devil's Slide photo post titles was causing Hugo to think
it was too long. I don't know exactly what. Checking the plain version fixed it.

Make sure to markdownify again for actual display though!
This commit is contained in:
Eryn Wells 2024-11-07 08:57:23 -08:00
parent 63eb00bf4a
commit ff3b345cb7

View file

@ -5,15 +5,15 @@
{{- $altText := $thumbnail.Params.alt -}}
{{- $linkTitle := .LinkTitle | markdownify -}}
{{- $showsTitle := le (len $linkTitle) 18 -}}
{{- $linkTitle := .LinkTitle -}}
{{- $showsTitle := le (len ($linkTitle | plainify)) 18 -}}
{{- if not $showsTitle -}}
{{ warnf "Title for photostream item is too long for grid: %s" .Permalink }}
{{- end -}}
<article class="photostream-item">
{{ if $showsTitle }}
<h3 class="photostream-item__title">{{ $linkTitle }}</h3>
<h3 class="photostream-item__title">{{ $linkTitle | markdownify }}</h3>
{{ end }}
<a href="{{ .RelPermalink }}"
{{- if not $showsTitle }} title="{{ .Title | markdownify }}"{{ end }}>