api icon indicating copy to clipboard operation
api copied to clipboard

Support `meta name="description"` tag

Open KararTY opened this issue 1 month ago • 0 comments

api currently does not read <meta name="description" content="" /> field.

Current code: https://github.com/Chatterino/api/blob/605921eaf0265686c6c106fbddf06da6c6508aeb/internal/resolvers/default/metafields.go#L13-L32

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 = cont

I'll leave this as an issue because I'm sure there are better ways of (re)writing this code.

KararTY avatar Dec 20 '25 01:12 KararTY