{* This Jet template block renders a comments section for either illustrations or novels. It takes two parameters: - data: The data object containing comment information (either Illust or Novel) - contentType: A string indicating the type of content ("illust" or "novel") The block handles displaying the comment count, whether comments are disabled, and renders a list of comments if available. Usage: {{- yield Comments(data=.Illust, contentType="illust") }} or {{- yield Comments(data=.Novel, contentType="novel") }} NOTE: Ensure that the data object contains the necessary fields for comments. *} {{- block Comments(data, contentType) }}
{{- commentCount := contentType == "illust" ? data.Comments : data.CommentCount }} {{- commentDisabled := contentType == "illust" ? data.CommentDisabled : data.CommentOff }} {{- if commentCount == 0 }}

0 Comments

{{- else if commentCount == 1 }}

1 Comment

{{- else }}

{{ commentCount }} Comments

{{- end }} {{- if commentDisabled == 1 }}

The creator turned comments off

{{- else if commentCount == 0 }}

There are no comments yet

{{- else }}
{{ range data.CommentsList }}
{* checks whether .AuthorName is empty, indicating a deleted user *} {{- if .AuthorName != "" }} {{ .AuthorName }} {{- else }} {{ .AuthorName }} {{- end }}
{{- if .AuthorName != "" }} {{- .AuthorName }} {{- else }}

Deleted user

{{- end }}
{{ .Date }}
{{- if .Stamp }} /proxy/s.pximg.net/common/images/stamp/generated-stamps/{{ .Stamp }}_s.jpg {{- else }}

{{ raw: parseEmojis(.Context) }}

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