-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
api currently does not read <meta name="description" content="" /> field.
Current code:
api/internal/resolvers/default/metafields.go
Lines 13 to 32 in 605921e
| if fields.Size() > 0 { | |
| fields.Each(func(i int, s *goquery.Selection) { | |
| prop, _ := s.Attr("property") | |
| cont, _ := s.Attr("content") | |
| switch { | |
| /* Support for HTML Open Graph & Twitter meta tags. | |
| * Will show Open Graph & Twitter "Title", "Description", "Image" information of webpages. | |
| * More OG fields & information: https://ogp.me/ | |
| * More Twitter fields & information: https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup | |
| */ | |
| case (prop == "og:title" || prop == "twitter:title") && data.Title == "": | |
| data.Title = cont | |
| case (prop == "og:description" || prop == "twitter:description") && data.Description == "": | |
| data.Description = cont | |
| case (prop == "og:image" || prop == "twitter:image") && data.ImageSrc == "": | |
| data.ImageSrc = utils.FormatThumbnailURL(baseURL, r, cont) | |
| } | |
| }) | |
| } |
A quick & dirty change is to additionally read the "name" property
prop, _ := s.Attr("property")
if prop == "" {
prop, _ = s.Attr("name")
}and then read "description":
case (prop == "og:description" || prop == "twitter:description" || prop == "description") && data.Description == "":
data.Description = contI'll leave this as an issue because I'm sure there are better ways of (re)writing this code.
Metadata
Metadata
Assignees
Labels
No labels