Skip to content

Commit 458aec1

Browse files
committed
feat(template): add noindex meta tag #661
1 parent 29b40ab commit 458aec1

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

internal/controller/template_controller.go

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package controller
2222
import (
2323
"encoding/json"
2424
"fmt"
25+
"github.com/apache/incubator-answer/internal/entity"
2526
"html/template"
2627
"net/http"
2728
"regexp"
@@ -376,6 +377,7 @@ func (tc *TemplateController) QuestionInfo(ctx *gin.Context) {
376377
"detail": detail,
377378
"answers": answers,
378379
"comments": comments,
380+
"noindex": detail.Show == entity.QuestionHide,
379381
})
380382
}
381383

ui/template/header.html

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<meta name="description" content="{{.description}}" data-rh="true" />
3030
<meta name="generator" content="Answer {{.Version}} - https://github.com/apache/incubator-answer version {{.Revision}}">
3131
{{if .keywords }}<meta name="keywords" content="{{.keywords}}" data-rh="true" />{{end}}
32+
{{if .noindex }}<meta name="robots" content="noindex">{{end}}
3233

3334
<link rel="canonical" href="{{.siteinfo.Canonical}}" />
3435
<link rel="manifest" href="/manifest.json" />

0 commit comments

Comments
 (0)