Truncating a TITLE atrribute

Is it possible to truncate a TITLE attribute from a markdown file using a shortcode?

{{- $line := "" -}}
{{- range (split .Inner "\n") -}}
{{- $line = trim . " " -}}
{{- if gt (len $line) 0 }}

{{ $line | $.Page.RenderString | truncate 75 }}

{{- end }}
{{- end }}


{< referencesfull >}}
[ LONG_CONTENT ](https://url.url/ "LONG_TITLE_ATTRIBUTE")
{{< /referencesfull >}}

The above will truncate the content of a link to 75 characters but not the title attribute.

You can do that with a render hook.

Brilliant! It works perfectly. Thank you.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.