Added Open Graph data to anime
This commit is contained in:
parent
4cac9f5544
commit
e47f1d298f
@ -9,5 +9,6 @@ import (
|
||||
// Render layout.
|
||||
func Render(ctx *aero.Context, content string) string {
|
||||
user := utils.GetUser(ctx)
|
||||
return components.Layout(ctx.App, ctx, user, content)
|
||||
meta, _ := ctx.Data.(map[string]string)
|
||||
return components.Layout(ctx.App, ctx, user, meta, content)
|
||||
}
|
||||
|
@ -1,9 +1,15 @@
|
||||
component Layout(app *aero.Application, ctx *aero.Context, user *arn.User, content string)
|
||||
component Layout(app *aero.Application, ctx *aero.Context, user *arn.User, meta map[string]string, content string)
|
||||
html(lang="en")
|
||||
head
|
||||
title= app.Config.Title
|
||||
|
||||
meta(name="viewport", content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes")
|
||||
meta(name="theme-color", content=app.Config.Manifest.ThemeColor)
|
||||
|
||||
if meta != nil
|
||||
for property, value := range meta
|
||||
meta(name=property, value=value)
|
||||
|
||||
link(rel="chrome-webstore-item", href="https://chrome.google.com/webstore/detail/hajchfikckiofgilinkpifobdbiajfch")
|
||||
link(rel="manifest", href="/manifest.json")
|
||||
body
|
||||
|
@ -39,5 +39,22 @@ func Get(ctx *aero.Context) string {
|
||||
}
|
||||
}
|
||||
|
||||
// Open Graph
|
||||
openGraph := map[string]string{
|
||||
"og:title": anime.Title.Canonical,
|
||||
"og:image": anime.Image.Large,
|
||||
"og:url": "https://" + ctx.App.Config.Domain + anime.Link(),
|
||||
"og:site_name": "notify.moe",
|
||||
}
|
||||
|
||||
switch anime.Type {
|
||||
case "tv":
|
||||
openGraph["og:type"] = "video.tv_show"
|
||||
case "movie":
|
||||
openGraph["og:type"] = "video.movie"
|
||||
}
|
||||
|
||||
ctx.Data = openGraph
|
||||
|
||||
return ctx.HTML(components.Anime(anime, tracks, user, episodesReversed))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user