Minor change
This commit is contained in:
parent
b8b2fb9354
commit
99f5ae1b4f
@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/server/middleware"
|
||||
)
|
||||
@ -126,34 +125,3 @@ func Get(ctx aero.Context) error {
|
||||
|
||||
return ctx.HTML(components.Anime(anime, animeListItem, tracks, amvs, amvAppearances, episodes, friends, friendsAnimeListItems, episodeToFriends, user))
|
||||
}
|
||||
|
||||
func getOpenGraph(anime *arn.Anime) *arn.OpenGraph {
|
||||
description := anime.Summary
|
||||
|
||||
if len(description) > maxDescriptionLength {
|
||||
description = description[:maxDescriptionLength-3] + "..."
|
||||
}
|
||||
|
||||
openGraph := &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": anime.Title.Canonical,
|
||||
"og:image": "https:" + anime.ImageLink("large"),
|
||||
"og:url": "https://" + assets.Domain + anime.Link(),
|
||||
"og:site_name": "notify.moe",
|
||||
"og:description": description,
|
||||
},
|
||||
Meta: map[string]string{
|
||||
"description": description,
|
||||
"keywords": anime.Title.Canonical + ",anime",
|
||||
},
|
||||
}
|
||||
|
||||
switch anime.Type {
|
||||
case "tv":
|
||||
openGraph.Tags["og:type"] = "video.tv_show"
|
||||
case "movie":
|
||||
openGraph.Tags["og:type"] = "video.movie"
|
||||
}
|
||||
|
||||
return openGraph
|
||||
}
|
||||
|
37
pages/anime/opengraph.go
Normal file
37
pages/anime/opengraph.go
Normal file
@ -0,0 +1,37 @@
|
||||
package anime
|
||||
|
||||
import (
|
||||
"github.com/animenotifier/notify.moe/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
)
|
||||
|
||||
func getOpenGraph(anime *arn.Anime) *arn.OpenGraph {
|
||||
description := anime.Summary
|
||||
|
||||
if len(description) > maxDescriptionLength {
|
||||
description = description[:maxDescriptionLength-3] + "..."
|
||||
}
|
||||
|
||||
openGraph := &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": anime.Title.Canonical,
|
||||
"og:image": "https:" + anime.ImageLink("large"),
|
||||
"og:url": "https://" + assets.Domain + anime.Link(),
|
||||
"og:site_name": "notify.moe",
|
||||
"og:description": description,
|
||||
},
|
||||
Meta: map[string]string{
|
||||
"description": description,
|
||||
"keywords": anime.Title.Canonical + ",anime",
|
||||
},
|
||||
}
|
||||
|
||||
switch anime.Type {
|
||||
case "tv":
|
||||
openGraph.Tags["og:type"] = "video.tv_show"
|
||||
case "movie":
|
||||
openGraph.Tags["og:type"] = "video.movie"
|
||||
}
|
||||
|
||||
return openGraph
|
||||
}
|
Loading…
Reference in New Issue
Block a user