21 lines
908 B
HTML
21 lines
908 B
HTML
{{- /* Get post description or generate it from the post content */ -}}
|
|
{{- $max_length := default 200 .Params.max_length -}}
|
|
|
|
{{- $description := "" -}}
|
|
{{- if .Description -}}
|
|
{{- $description = .Description -}}
|
|
{{- else if .Params.description -}}
|
|
{{- $description = .Params.description -}}
|
|
{{- else -}}
|
|
{{- /* Remove the line number of the code snippet */ -}}
|
|
{{- $content := .Content -}}
|
|
|
|
{{- if findRE `<td class="rouge-gutter gl"><pre class="lineno">` $content -}}
|
|
{{- $content = replace $content `<td class="rouge-gutter gl"><pre class="lineno">` `<!-- <td class="rouge-gutter gl"><pre class="lineno">` -}}
|
|
{{- $content = replace $content `</td><td class="rouge-code">` `</td> --><td class="rouge-code">` -}}
|
|
{{- end -}}
|
|
|
|
{{- $description = $content | markdownify | plainify | replaceRE `\s+` ` ` -}}
|
|
{{- end -}}
|
|
|
|
{{- (trim $description " ") | truncate $max_length | safeHTML -}} |