From 458aec1f441538ab0b5889632251a0e7841e3674 Mon Sep 17 00:00:00 2001 From: LinkinStars Date: Wed, 3 Jan 2024 15:50:47 +0800 Subject: [PATCH] feat(template): add noindex meta tag #661 --- internal/controller/template_controller.go | 2 ++ ui/template/header.html | 1 + 2 files changed, 3 insertions(+) diff --git a/internal/controller/template_controller.go b/internal/controller/template_controller.go index 88e8ca0a..6b4c4bbe 100644 --- a/internal/controller/template_controller.go +++ b/internal/controller/template_controller.go @@ -22,6 +22,7 @@ package controller import ( "encoding/json" "fmt" + "github.com/apache/incubator-answer/internal/entity" "html/template" "net/http" "regexp" @@ -376,6 +377,7 @@ func (tc *TemplateController) QuestionInfo(ctx *gin.Context) { "detail": detail, "answers": answers, "comments": comments, + "noindex": detail.Show == entity.QuestionHide, }) } diff --git a/ui/template/header.html b/ui/template/header.html index 5471391d..85425674 100644 --- a/ui/template/header.html +++ b/ui/template/header.html @@ -29,6 +29,7 @@ {{if .keywords }}{{end}} + {{if .noindex }}{{end}}