print a user-defined number of sentences in the about excerpt

This commit is contained in:
acarril 2023-05-01 18:00:57 -04:00
parent 69f7b18a88
commit 2f3a6b3e24

View file

@ -1,3 +1,5 @@
{{ $about := .Site.GetPage "about" }}
{{ $firstParagraph := (findRE "<p>.*?</p>" ($about.Content) 1) }}
{{ safeHTML (index $firstParagraph 0) }}
{{ $sentencesCount := (default 2 .Site.Params.aboutExcerptSentences) }}
{{ $pattern := print "<p>(.*?\\.([[:space:]]|</p>)){" $sentencesCount "}" }}
{{ $excerpt := (findRE $pattern ($about.Content) 1) }}
{{ safeHTML (index $excerpt 0) }}