Merge remote-tracking branch 'origin/feat/0.6.0/seo' into feat/0.6.0/seo

This commit is contained in:
kumfo 2022-12-07 11:14:10 +08:00
commit a3aec66dd1
3 changed files with 21 additions and 2 deletions

View File

@ -261,6 +261,14 @@ func (tc *TemplateController) TagInfo(ctx *gin.Context) {
// UserInfo user info
func (tc *TemplateController) UserInfo(ctx *gin.Context) {
// urlPath := ctx.Request.URL.Path
// filePath := ""
// switch urlPath {
// case "/users/login":
// filePath = "build/index.html"
// case "/users/register":
// filePath = "build/index.html"
// default:
username := ctx.Param("username")
req := &schema.GetOtherUserInfoByUsernameReq{}
req.Username = username
@ -280,6 +288,17 @@ func (tc *TemplateController) UserInfo(ctx *gin.Context) {
"userinfo": userinfo,
"bio": template.HTML(userinfo.Info.BioHTML),
})
// }
// file, err := ui.Build.ReadFile(filePath)
// if err != nil {
// log.Error(err)
// ctx.Status(http.StatusNotFound)
// return
// }
// ctx.Header("content-type", "text/html;charset=utf-8")
// ctx.String(http.StatusOK, string(file))
}
func (tc *TemplateController) Page404(ctx *gin.Context) {

View File

@ -41,6 +41,6 @@ func (a *TemplateRouter) RegisterTemplateRouter(r *gin.RouterGroup) {
r.GET("/tags", a.templateController.TagList)
r.GET("/tags/:tag", a.templateController.TagInfo)
r.GET("/users/:username", a.templateController.UserInfo)
// r.GET("/users/:username", a.templateController.UserInfo)
r.GET("/404", a.templateController.Page404)
}

View File

@ -10,7 +10,7 @@
<link rel="canonical" href="{{.siteinfo.Canonical}}" />
<link rel="manifest" href="/manifest.json"/>
<link href="{{.cssPath}}" rel="stylesheet" />
<!-- <script defer="defer" src="{{.scriptPath}}"></script> -->
<script defer="defer" src="{{.scriptPath}}"></script>
{{if $.siteinfo.JsonLD }}{{ .siteinfo.JsonLD | templateHTML}}{{end}}
</head>