Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

add html meta generator

aichy126011c992570ef
diff --git a/docs/docs.go b/docs/docs.go
index cce01432..24693e47 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -2911,6 +2911,45 @@ const docTemplate = `{
}
}
},
+ "/answer/api/v1/post/render": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "render post content",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Upload"
+ ],
+ "summary": "render post content",
+ "parameters": [
+ {
+ "description": "PostRenderReq",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.PostRenderReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
"/answer/api/v1/question": {
"put": {
"security": [
@@ -6589,6 +6628,14 @@ const docTemplate = `{
}
}
},
+ "schema.PostRenderReq": {
+ "type": "object",
+ "properties": {
+ "content": {
+ "type": "string"
+ }
+ }
+ },
"schema.QuestionAdd": {
"type": "object",
"required": [
@@ -6669,6 +6716,9 @@ const docTemplate = `{
"collection_count": {
"type": "integer"
},
+ "created_at": {
+ "type": "integer"
+ },
"description": {
"type": "string"
},
diff --git a/docs/swagger.json b/docs/swagger.json
index 3503fce7..fb2f297b 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -2899,6 +2899,45 @@
}
}
},
+ "/answer/api/v1/post/render": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "render post content",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Upload"
+ ],
+ "summary": "render post content",
+ "parameters": [
+ {
+ "description": "PostRenderReq",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.PostRenderReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
"/answer/api/v1/question": {
"put": {
"security": [
@@ -6577,6 +6616,14 @@
}
}
},
+ "schema.PostRenderReq": {
+ "type": "object",
+ "properties": {
+ "content": {
+ "type": "string"
+ }
+ }
+ },
"schema.QuestionAdd": {
"type": "object",
"required": [
@@ -6657,6 +6704,9 @@
"collection_count": {
"type": "integer"
},
+ "created_at": {
+ "type": "integer"
+ },
"description": {
"type": "string"
},
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index b02e9494..fef405df 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -976,6 +976,11 @@ definitions:
type:
type: string
type: object
+ schema.PostRenderReq:
+ properties:
+ content:
+ type: string
+ type: object
schema.QuestionAdd:
properties:
content:
@@ -1036,6 +1041,8 @@ definitions:
type: integer
collection_count:
type: integer
+ created_at:
+ type: integer
description:
type: string
follow_count:
@@ -3684,6 +3691,30 @@ paths:
summary: user's votes
tags:
- Activity
+ /answer/api/v1/post/render:
+ post:
+ consumes:
+ - application/json
+ description: render post content
+ parameters:
+ - description: PostRenderReq
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.PostRenderReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: render post content
+ tags:
+ - Upload
/answer/api/v1/question:
delete:
consumes:
diff --git a/internal/controller/template_controller.go b/internal/controller/template_controller.go
index c97c81b4..6d7c2410 100644
--- a/internal/controller/template_controller.go
+++ b/internal/controller/template_controller.go
@@ -25,6 +25,7 @@ import (
type TemplateController struct {
scriptPath string
cssPath string
+ Version string
templateRenderController *templaterender.TemplateRenderController
siteInfoService *siteinfo_common.SiteInfoCommonService
}
@@ -38,6 +39,7 @@ func NewTemplateController(
return &TemplateController{
scriptPath: script,
cssPath: css,
+ Version: constant.Version,
templateRenderController: templateRenderController,
siteInfoService: siteInfoService,
}
@@ -437,6 +439,7 @@ func (tc *TemplateController) html(ctx *gin.Context, code int, tpl string, siteI
data["HeadCode"] = siteInfo.CustomCssHtml.CustomHead
data["HeaderCode"] = siteInfo.CustomCssHtml.CustomHeader
data["FooterCode"] = siteInfo.CustomCssHtml.CustomFooter
+ data["Version"] = tc.Version
_, ok := data["path"]
if !ok {
data["path"] = ""
diff --git a/ui/template/header.html b/ui/template/header.html
index 3a12a6a8..5b654c56 100644
--- a/ui/template/header.html
+++ b/ui/template/header.html
@@ -6,9 +6,9 @@
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>{{.title}}</title>
<meta name="description" content="{{.description}}" data-rh="true" />
- {{if .keywords }}
- <meta name="keywords" content="{{.keywords}}" data-rh="true" />
- {{end}}
+ <meta name="generator" content="Answer {{.Version}} - https://github.com/answerdev/answer">
+ {{if .keywords }}<meta name="keywords" content="{{.keywords}}" data-rh="true" />{{end}}
+
<link rel="canonical" href="{{.siteinfo.Canonical}}" />
<link rel="manifest" href="/manifest.json" />
<link href="{{.cssPath}}" rel="stylesheet" />