mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-22 17:34:03 +03:00
Support for custom html meta (#1423)
* Support for custom html meta * Changed html meta description default
This commit is contained in:
parent
6a39250579
commit
095e1f5155
5
conf/app.ini
vendored
5
conf/app.ini
vendored
@ -74,6 +74,11 @@ ORG_PAGING_NUM = 50
|
|||||||
; Number of repos that are showed in one page
|
; Number of repos that are showed in one page
|
||||||
REPO_PAGING_NUM = 15
|
REPO_PAGING_NUM = 15
|
||||||
|
|
||||||
|
[ui.meta]
|
||||||
|
AUTHOR = Gitea - Git with a cup of tea
|
||||||
|
DESCRIPTION = Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go
|
||||||
|
KEYWORDS = go,git,self-hosted,gitea
|
||||||
|
|
||||||
[markdown]
|
[markdown]
|
||||||
; Enable hard line break extension
|
; Enable hard line break extension
|
||||||
ENABLE_HARD_LINE_BREAK = false
|
ENABLE_HARD_LINE_BREAK = false
|
||||||
|
@ -226,6 +226,11 @@ var (
|
|||||||
User struct {
|
User struct {
|
||||||
RepoPagingNum int
|
RepoPagingNum int
|
||||||
} `ini:"ui.user"`
|
} `ini:"ui.user"`
|
||||||
|
Meta struct {
|
||||||
|
Author string
|
||||||
|
Description string
|
||||||
|
Keywords string
|
||||||
|
} `ini:"ui.meta"`
|
||||||
}{
|
}{
|
||||||
ExplorePagingNum: 20,
|
ExplorePagingNum: 20,
|
||||||
IssuePagingNum: 10,
|
IssuePagingNum: 10,
|
||||||
@ -248,6 +253,15 @@ var (
|
|||||||
}{
|
}{
|
||||||
RepoPagingNum: 15,
|
RepoPagingNum: 15,
|
||||||
},
|
},
|
||||||
|
Meta: struct {
|
||||||
|
Author string
|
||||||
|
Description string
|
||||||
|
Keywords string
|
||||||
|
}{
|
||||||
|
Author: "Gitea - Git with a cup of tea",
|
||||||
|
Description: "Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go",
|
||||||
|
Keywords: "go,git,self-hosted,gitea",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Markdown settings
|
// Markdown settings
|
||||||
|
@ -110,6 +110,15 @@ func NewFuncMap() []template.FuncMap {
|
|||||||
"ThemeColorMetaTag": func() string {
|
"ThemeColorMetaTag": func() string {
|
||||||
return setting.UI.ThemeColorMetaTag
|
return setting.UI.ThemeColorMetaTag
|
||||||
},
|
},
|
||||||
|
"MetaAuthor": func() string {
|
||||||
|
return setting.UI.Meta.Author
|
||||||
|
},
|
||||||
|
"MetaDescription": func() string {
|
||||||
|
return setting.UI.Meta.Description
|
||||||
|
},
|
||||||
|
"MetaKeywords": func() string {
|
||||||
|
return setting.UI.Meta.Keywords
|
||||||
|
},
|
||||||
"FilenameIsImage": func(filename string) bool {
|
"FilenameIsImage": func(filename string) bool {
|
||||||
mimeType := mime.TypeByExtension(filepath.Ext(filename))
|
mimeType := mime.TypeByExtension(filepath.Ext(filename))
|
||||||
return strings.HasPrefix(mimeType, "image/")
|
return strings.HasPrefix(mimeType, "image/")
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
<title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>
|
<title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>
|
||||||
<meta name="theme-color" content="{{ThemeColorMetaTag}}">
|
<meta name="theme-color" content="{{ThemeColorMetaTag}}">
|
||||||
<meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}Gitea - Git with a cup of tea{{end}}" />
|
<meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{MetaAuthor}}{{end}}" />
|
||||||
<meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go{{end}}" />
|
<meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{MetaDescription}}{{end}}" />
|
||||||
<meta name="keywords" content="go, git, self-hosted, gitea">
|
<meta name="keywords" content="{{MetaKeywords}}">
|
||||||
<meta name="referrer" content="no-referrer" />
|
<meta name="referrer" content="no-referrer" />
|
||||||
<meta name="_csrf" content="{{.CsrfToken}}" />
|
<meta name="_csrf" content="{{.CsrfToken}}" />
|
||||||
<meta name="_suburl" content="{{AppSubUrl}}" />
|
<meta name="_suburl" content="{{AppSubUrl}}" />
|
||||||
@ -68,7 +68,7 @@
|
|||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:image" content="{{AppSubUrl}}/img/gitea-lg.png" />
|
<meta property="og:image" content="{{AppSubUrl}}/img/gitea-lg.png" />
|
||||||
<meta property="og:url" content="{{AppUrl}}" />
|
<meta property="og:url" content="{{AppUrl}}" />
|
||||||
<meta property="og:description" content="Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go">
|
<meta property="og:description" content="{{MetaDescription}}">
|
||||||
{{end}}
|
{{end}}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
Reference in New Issue
Block a user