From 700b7eaab727ae351e71514b677fa7b7dc65c51e Mon Sep 17 00:00:00 2001 From: tobi Date: Thu, 8 May 2025 11:11:25 +0000 Subject: [feature] Add extra opengraph meta tags (#4154) # Description > If this is a code change, please include a summary of what you've coded, and link to the issue(s) it closes/implements. > > If this is a documentation change, please briefly describe what you've changed and why. Update our opengraph meta tag code stuff: - Use `audio` and `video` types where appropriate. - Include fall back to `image` types. - Include `twitter:card=summary` or `twitter:card=summary_large_image` where appropriate (closes https://codeberg.org/superseriousbusiness/gotosocial/issues/2776) - Include avatar description where possible. - Include mime type for media. - Set `modified_time` properly based on latest edit time. Examples Status with one image attachment, that's been edited: ```html ``` Status with one audio file (with thumbnail): ```html ``` ## Checklist Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]` If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want). - [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md). - [x] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat. - [x] I/we have not leveraged AI to create the proposed changes. - [x] I/we have performed a self-review of added code. - [x] I/we have written code that is legible and maintainable by others. - [x] I/we have commented the added code, particularly in hard-to-understand areas. - [ ] I/we have made any necessary changes to documentation. - [x] I/we have added tests that cover new code. - [x] I/we have run tests and they pass locally with the changes. - [x] I/we have run `go fmt ./...` and `golangci-lint run`. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4154 Reviewed-by: Daenney Co-authored-by: tobi Co-committed-by: tobi --- web/template/page_ogmeta.tmpl | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'web') diff --git a/web/template/page_ogmeta.tmpl b/web/template/page_ogmeta.tmpl index 82bb4bbfb..8be10280d 100644 --- a/web/template/page_ogmeta.tmpl +++ b/web/template/page_ogmeta.tmpl @@ -25,14 +25,14 @@ {{- with .ogMeta }} {{- if .Locale }} - + {{- else }} {{- end }} - + {{- if .ArticlePublisher }} @@ -44,14 +44,34 @@ {{- else }} {{- end }} - -{{- if .ImageAlt }} - +{{- range $i, $m := .Media }} + +{{- if or (eq $m.OGType "video") (eq $m.OGType "audio") }} + {{- else }} {{- end }} -{{- if .ImageWidth }} - - +{{- if $m.MIMEType }} + {{- else }} {{- end }} +{{- if $m.Width }} + + +{{- else }} +{{- end }} +{{- if $m.Alt }} + +{{- else }} +{{- end }} +{{- end }} +{{- if .TwitterSummaryLargeImage }} + + +{{- if .TwitterImageAlt }} + +{{- else }} +{{- end }} +{{- else }} + +{{- end }} {{- end }} \ No newline at end of file -- cgit v1.3