fix: [template] Change default hugo template to generate markdown - to

fix the issue with media description containing new-lines.

Ref: https://codeberg.org/ggpsv/mastodon-markdown-archive/issues/1
This commit is contained in:
Alexandre Dulaunoy 2024-09-01 17:05:14 +02:00
parent d18757447e
commit fc4484b10d
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -1,44 +1,46 @@
---
date: {{ .Post.CreatedAt }}
{{- if .Post.InReplyToId }}
in_reply_to: {{ .Post.InReplyToId }}
{{- end }}
post_uri: {{ .Post.URI }}
post_id: {{ .Post.Id }}
{{- if len .Post.AllTags }}
tags:
{{- range .Post.AllTags }}
- {{ .Name }}
{{- end }}
{{- end }}
{{- if len .Post.Descendants }}
descendants:
{{- range .Post.Descendants }}
- {{ .Id }}
{{- end }}
{{- end }}
---
{{ .Post.Content | toMarkdown }}
{{ range .Post.MediaAttachments }}
{{- if eq .Type "image" }}
{{- if .Path }}
![{{ .Description }}]({{ osBase .Path }})
{{- else }}
![{{ .Description }}]({{ .URL }})
{{- end }}
{{ end }}
{{- end -}}
{{ range .Post.Descendants }}
{{ .Content | toMarkdown }}
{{ range .MediaAttachments }}
{{- if eq .Type "image" }}
{{- if .Path }}
![{{ .Description }}]({{ osBase .Path }})
{{- else }}
![{{ .Description }}]({{ .URL }})
{{- end }}
{{- end }}
{{- end }}
{{- end }}
---
date: {{ .Post.CreatedAt }}
{{- if .Post.InReplyToId }}
in_reply_to: {{ .Post.InReplyToId }}
{{- end }}
post_uri: {{ .Post.URI }}
post_id: {{ .Post.Id }}
{{- if len .Post.AllTags }}
tags:
{{- range .Post.AllTags }}
- {{ .Name }}
{{- end }}
{{- end }}
{{- if len .Post.Descendants }}
descendants:
{{- range .Post.Descendants }}
- {{ .Id }}
{{- end }}
{{- end }}
layout: page
title: paperbay.org Mastodon - {{ .Post.URI }}
---
{{ .Post.Content | toMarkdown }}
{{ range .Post.MediaAttachments }}
{{- if eq .Type "image" }}
{{- if .Path }}
![{{ .Description | replace "\n" "" }}]({{ osBase .Path }})
{{- else }}
![{{ .Description | replace "\n" "" }}]({{ .URL }})
{{- end }}
{{ end }}
{{- end -}}
{{ range .Post.Descendants }}
{{ .Content | toMarkdown }}
{{ range .MediaAttachments }}
{{- if eq .Type "image" }}
{{- if .Path }}
![{{ .Description | replace "\n" ""}}]({{ osBase .Path }})
{{- else }}
![{{ .Description | replace "\n" ""}}]({{ .URL }})
{{- end }}
{{- end }}
{{- end }}
{{- end }}