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-view
.group-sidebar.mountable .group-sidebar.mountable
if group.Description != ""
.group-sidebar-section .group-sidebar-section
h3 Description h3 Description
.group-description!= markdown.Render(group.Description) .group-description!= markdown.Render(group.Description)
if group.Rules != ""
.group-sidebar-section .group-sidebar-section
h3 Rules h3 Rules
.group-rules!= markdown.Render(group.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) return ctx.Error(http.StatusNotFound, "Track not found", err)
} }
ctx.Data = &arn.OpenGraph{ openGraph := &arn.OpenGraph{
Tags: map[string]string{ Tags: map[string]string{
"og:title": track.Title, "og:title": track.Title,
"og:url": "https://" + ctx.App.Config.Domain + track.Link(), "og:url": "https://" + ctx.App.Config.Domain + track.Link(),
@ -27,8 +27,16 @@ func Get(ctx *aero.Context) string {
} }
if track.MainAnime() != nil { 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)) return ctx.HTML(components.Track(track))
} }