From ba4a9155a78ecec3c2c52c68b9ded498a3c11667 Mon Sep 17 00:00:00 2001 From: httpjamesm Date: Wed, 28 Dec 2022 00:58:41 -0500 Subject: [PATCH] feat: OG metadata and shortened desc --- src/routes/question.go | 15 ++++++++------- templates/home.html | 3 +++ templates/question.html | 3 +++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/routes/question.go b/src/routes/question.go index 07efcc9..ce101cd 100644 --- a/src/routes/question.go +++ b/src/routes/question.go @@ -148,13 +148,14 @@ func ViewQuestion(c *gin.Context) { } c.HTML(200, "question.html", gin.H{ - "title": questionText, - "body": template.HTML(questionBodyParentHTML), - "timestamp": questionTimestamp, - "author": questionAuthor, - "authorURL": questionAuthorURL, - "answers": answers, - "imagePolicy": imagePolicy, + "title": questionText, + "body": template.HTML(questionBodyParentHTML), + "timestamp": questionTimestamp, + "author": questionAuthor, + "authorURL": questionAuthorURL, + "answers": answers, + "imagePolicy": imagePolicy, + "shortenedBody": questionBodyParent.Text()[0:50], }) } diff --git a/templates/home.html b/templates/home.html index 385f3fc..a51d76b 100644 --- a/templates/home.html +++ b/templates/home.html @@ -10,6 +10,9 @@ content="default-src 'none'; style-src 'self'; script-src 'none'; img-src 'self';" /> + + +
diff --git a/templates/question.html b/templates/question.html index afad65c..d7e683d 100644 --- a/templates/question.html +++ b/templates/question.html @@ -10,6 +10,9 @@ content="default-src 'none'; style-src 'self'; script-src 'none'; img-src {{ .imagePolicy }};" /> + + +