{{- define "main" -}} {{/* Pagefind metadata for search filtering */}}
{{/* Use hidden spans for filter values - best practice per Pagefind docs */}} questions {{ with .Params.categories }} {{ index . 0 }} {{ end }} {{ with .Params.difficulty }} {{ . }} {{ end }}
{{ partial "components/sidebar.html" (dict "context" . "no_sidebar" false) }} {{ partial "components/toc.html" . }}
{{ if (.Params.show_breadcrumb | default true) }}
{{ partial "components/breadcrumb.html" . }}
{{ end }} {{/* Question as title */}}

{{ .Params.question | default .Title }}

{{/* Metadata */}}
{{ if .Date }}
{{ end }} {{ if .Lastmod }}
Updated {{ .Lastmod.Format "January 2, 2006" }}
{{ end }} {{ with .Params.difficulty }} {{ . }} {{ end }}
{{/* Tags and Categories */}}
{{ range .Params.tags }} #{{ . }} {{ end }} {{ range .Params.categories }} {{ . }} {{ end }}
{{/* Accepted Answer */}}
{{ if .Params.answer }} {{/* Explicit answer parameter */}}
{{ T "accepted_answer" | default "Accepted Answer" }}
{{ .Params.answer | markdownify }}
{{ end }} {{/* Full content */}}
{{ .Content }}
{{/* Suggested/Additional Answers */}} {{ with .Params.suggested_answer }}

{{ T "other_answers" | default "Other Answers" }}

{{ range $index, $answer := . }}
{{ with $answer.author }}
{{ . }} {{ with $answer.date }} ยท {{ (time .) | time.Format "January 2, 2006" }}{{ end }}
{{ end }}
{{ $answer.text | markdownify }}
{{ with $answer.upvote_count }}
๐Ÿ‘ {{ . }} {{ T "helpful" | default "helpful" }}
{{ end }}
{{ end }}
{{ end }} {{/* Related Q&As */}} {{ $related := .Site.RegularPages.Related . | first 5 }} {{ with $related }}

{{ T "related_questions" | default "Related Questions" }}

{{ end }} {{ partial "components/last-edited.html" . }} {{ partial "components/next-in-series.html" . }} {{ partial "components/feedback.html" . }} {{ partial "comments.html" . }}
{{/* End Pagefind metadata wrapper */}} {{- end -}}