diff --git a/src/routes/question.go b/src/routes/question.go index de14ca5..23ad8c8 100644 --- a/src/routes/question.go +++ b/src/routes/question.go @@ -74,6 +74,7 @@ func ViewQuestion(c *gin.Context) { newFilteredQuestion.ShortenedBody = shortenedBody comments := utils.FindAndReturnComments(questionBodyParentHTML, questionPostLayout) + newFilteredQuestion.Comments = comments // parse any code blocks and highlight them answerCodeBlocks := questionCodeBlockRegex.FindAllString(questionBodyParentHTML, -1) diff --git a/src/types/question.go b/src/types/question.go index 1aeba70..2850532 100644 --- a/src/types/question.go +++ b/src/types/question.go @@ -9,4 +9,5 @@ type FilteredQuestion struct { AuthorName string AuthorURL string ShortenedBody string + Comments []FilteredComment } diff --git a/templates/question.html b/templates/question.html index c10896c..ac498f4 100644 --- a/templates/question.html +++ b/templates/question.html @@ -46,6 +46,34 @@
+ Show {{ (len .question.Comments) }} comments +
+