Added video to soundtrack OpenGraph

This commit is contained in:
Eduard Urbach 2017-10-18 22:09:17 +02:00
parent 3f27562581
commit 677dc45184
2 changed files with 18 additions and 8 deletions

View File

@ -8,10 +8,12 @@ component Group(group *arn.Group)
.group-view
.group-sidebar.mountable
if group.Description != ""
.group-sidebar-section
h3 Description
.group-description!= markdown.Render(group.Description)
if group.Rules != ""
.group-sidebar-section
h3 Rules
.group-rules!= markdown.Render(group.Rules)

View File

@ -17,7 +17,7 @@ func Get(ctx *aero.Context) string {
return ctx.Error(http.StatusNotFound, "Track not found", err)
}
ctx.Data = &arn.OpenGraph{
openGraph := &arn.OpenGraph{
Tags: map[string]string{
"og:title": track.Title,
"og:url": "https://" + ctx.App.Config.Domain + track.Link(),
@ -27,8 +27,16 @@ func Get(ctx *aero.Context) string {
}
if track.MainAnime() != nil {
ctx.Data.(*arn.OpenGraph).Tags["og:image"] = track.MainAnime().Image.Large
openGraph.Tags["og:image"] = track.MainAnime().Image.Large
}
// Set video so that it can be played
youtube := track.MediaByName("Youtube")
if len(youtube) > 0 {
openGraph.Tags["og:video"] = "https://www.youtube.com/v/" + youtube[0].ServiceID
}
ctx.Data = openGraph
return ctx.HTML(components.Track(track))
}