Improved open graph data

This commit is contained in:
Eduard Urbach 2017-11-29 14:44:02 +01:00
parent 7c65ea8cc6
commit 7d2136a973

View File

@ -21,10 +21,11 @@ func Get(ctx *aero.Context) string {
openGraph := &arn.OpenGraph{ openGraph := &arn.OpenGraph{
Tags: map[string]string{ Tags: map[string]string{
"og:title": company.Name.English, "og:title": company.Name.English,
"og:url": "https://" + ctx.App.Config.Domain + company.Link(), "og:description": company.Description,
"og:site_name": "notify.moe", "og:url": "https://" + ctx.App.Config.Domain + company.Link(),
"og:type": "article", "og:site_name": "notify.moe",
"og:type": "article",
}, },
} }
@ -32,6 +33,12 @@ func Get(ctx *aero.Context) string {
openGraph.Tags["og:image"] = company.Image openGraph.Tags["og:image"] = company.Image
} }
if company.Description != "" {
openGraph.Tags["og:description"] = company.Description
} else {
openGraph.Tags["og:description"] = company.Name.English + " company information."
}
ctx.Data = openGraph ctx.Data = openGraph
return ctx.HTML(components.CompanyPage(company, user)) return ctx.HTML(components.CompanyPage(company, user))
} }