gotosocial/web/template/page_ogmeta.tmpl

77 lines
2.9 KiB
Cheetah
Raw Normal View History

{{- /*
// GoToSocial
// Copyright (C) GoToSocial Authors admin@gotosocial.org
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ -}}
{{- /*
OPEN GRAPH META TAGS
To enable fancy previews of links to GtS posts/profiles shared via instant
messaging, or other social media, parse out provided Open Graph meta tags.
*/ -}}
{{- with .ogMeta }}
{{- if .Locale }}
[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 <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JE3BQPNHWNHSNM0KS78X321Q"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="cowards: &#34;I&#39;ll be a few minutes late, sorry!&#34; me:"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-22T07:24:49.773Z"> <meta property="og:article:published_time" content="2024-12-02T09:37:58.449Z"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta property="og:image:type" content="image/png"> <meta property="og:image:width" content="1224"> <meta property="og:image:height" content="368"> <meta property="og:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta name="twitter:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> ``` Status with one audio file (with thumbnail): ```html <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JSV5BQ585HB4R8NPK4ANTG91"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="service top anthem imo"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:article:published_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:audio" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:secure_url" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:type" content="audio/mpeg"> <meta property="og:audio:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/small/01JSV5AJ4RF3E6DATCSW8SAY93.webp"> <meta property="og:image:type" content="image/webp"> <meta property="og:image:width" content="500"> <meta property="og:image:height" content="500"> <meta property="og:image:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary"> ``` ## 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 <daenney@noreply.codeberg.org> Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
2025-05-08 11:11:25 +00:00
<meta property="og:locale" content="{{- .Locale -}}">
{{- else }}
{{- end }}
<meta property="og:type" content="{{- .Type -}}">
<meta property="og:title" content="{{- demojify .Title | noescape -}}">
<meta property="og:url" content="{{- .URL -}}">
<meta property="og:site_name" content="{{- .SiteName -}}">
[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 <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JE3BQPNHWNHSNM0KS78X321Q"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="cowards: &#34;I&#39;ll be a few minutes late, sorry!&#34; me:"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-22T07:24:49.773Z"> <meta property="og:article:published_time" content="2024-12-02T09:37:58.449Z"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta property="og:image:type" content="image/png"> <meta property="og:image:width" content="1224"> <meta property="og:image:height" content="368"> <meta property="og:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta name="twitter:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> ``` Status with one audio file (with thumbnail): ```html <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JSV5BQ585HB4R8NPK4ANTG91"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="service top anthem imo"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:article:published_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:audio" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:secure_url" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:type" content="audio/mpeg"> <meta property="og:audio:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/small/01JSV5AJ4RF3E6DATCSW8SAY93.webp"> <meta property="og:image:type" content="image/webp"> <meta property="og:image:width" content="500"> <meta property="og:image:height" content="500"> <meta property="og:image:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary"> ``` ## 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 <daenney@noreply.codeberg.org> Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
2025-05-08 11:11:25 +00:00
<meta property="og:description" content="{{- demojify .Description | noescape -}}">
{{- if .ArticlePublisher }}
<meta property="og:article:publisher" content="{{ .ArticlePublisher }}">
<meta property="og:article:author" content="{{ .ArticleAuthor }}">
<meta property="og:article:modified_time" content="{{ .ArticleModifiedTime }}">
<meta property="og:article:published_time" content="{{ .ArticlePublishedTime }}">
{{- else }}
{{- end }}
{{- if .ProfileUsername }}
<meta property="og:profile:username" content="{{- .ProfileUsername -}}">
{{- else }}
{{- end }}
[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 <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JE3BQPNHWNHSNM0KS78X321Q"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="cowards: &#34;I&#39;ll be a few minutes late, sorry!&#34; me:"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-22T07:24:49.773Z"> <meta property="og:article:published_time" content="2024-12-02T09:37:58.449Z"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta property="og:image:type" content="image/png"> <meta property="og:image:width" content="1224"> <meta property="og:image:height" content="368"> <meta property="og:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta name="twitter:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> ``` Status with one audio file (with thumbnail): ```html <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JSV5BQ585HB4R8NPK4ANTG91"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="service top anthem imo"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:article:published_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:audio" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:secure_url" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:type" content="audio/mpeg"> <meta property="og:audio:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/small/01JSV5AJ4RF3E6DATCSW8SAY93.webp"> <meta property="og:image:type" content="image/webp"> <meta property="og:image:width" content="500"> <meta property="og:image:height" content="500"> <meta property="og:image:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary"> ``` ## 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 <daenney@noreply.codeberg.org> Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
2025-05-08 11:11:25 +00:00
{{- range $i, $m := .Media }}
<meta property="og:{{- $m.OGType -}}" content="{{- $m.URL -}}">
{{- if or (eq $m.OGType "video") (eq $m.OGType "audio") }}
<meta property="og:{{- $m.OGType -}}:secure_url" content="{{- $m.URL -}}">
{{- else }}
{{- end }}
[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 <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JE3BQPNHWNHSNM0KS78X321Q"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="cowards: &#34;I&#39;ll be a few minutes late, sorry!&#34; me:"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-22T07:24:49.773Z"> <meta property="og:article:published_time" content="2024-12-02T09:37:58.449Z"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta property="og:image:type" content="image/png"> <meta property="og:image:width" content="1224"> <meta property="og:image:height" content="368"> <meta property="og:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta name="twitter:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> ``` Status with one audio file (with thumbnail): ```html <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JSV5BQ585HB4R8NPK4ANTG91"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="service top anthem imo"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:article:published_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:audio" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:secure_url" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:type" content="audio/mpeg"> <meta property="og:audio:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/small/01JSV5AJ4RF3E6DATCSW8SAY93.webp"> <meta property="og:image:type" content="image/webp"> <meta property="og:image:width" content="500"> <meta property="og:image:height" content="500"> <meta property="og:image:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary"> ``` ## 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 <daenney@noreply.codeberg.org> Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
2025-05-08 11:11:25 +00:00
{{- if $m.MIMEType }}
<meta property="og:{{- $m.OGType -}}:type" content="{{ $m.MIMEType }}">
{{- else }}
{{- end }}
[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 <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JE3BQPNHWNHSNM0KS78X321Q"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="cowards: &#34;I&#39;ll be a few minutes late, sorry!&#34; me:"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-22T07:24:49.773Z"> <meta property="og:article:published_time" content="2024-12-02T09:37:58.449Z"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta property="og:image:type" content="image/png"> <meta property="og:image:width" content="1224"> <meta property="og:image:height" content="368"> <meta property="og:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JE3BPJ1TGMV6H6E8VY0ED5XA.png"> <meta name="twitter:image:alt" content="Screenshot of a signal conversation where I wrote &#34;Just gonna smash out a quick poo&#34; and my friend responded with a sad face."> ``` Status with one audio file (with thumbnail): ```html <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="og:title" content="Post by Kip Van Den Bos, salad enjoyer, @tobi@goblin.technology"> <meta property="og:url" content="https://goblin.technology/@tobi/statuses/01JSV5BQ585HB4R8NPK4ANTG91"> <meta property="og:site_name" content="goblin.technology"> <meta property="og:description" content="service top anthem imo"> <meta property="og:article:publisher" content="https://goblin.technology/@tobi"> <meta property="og:article:author" content="https://goblin.technology/@tobi"> <meta property="og:article:modified_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:article:published_time" content="2025-04-27T08:21:00.712Z"> <meta property="og:audio" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:secure_url" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01JSV5AJ4RF3E6DATCSW8SAY93.mp3"> <meta property="og:audio:type" content="audio/mpeg"> <meta property="og:audio:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/small/01JSV5AJ4RF3E6DATCSW8SAY93.webp"> <meta property="og:image:type" content="image/webp"> <meta property="og:image:width" content="500"> <meta property="og:image:height" content="500"> <meta property="og:image:alt" content="Sanctified by Nine Inch Nails, from Pretty Hate Machine"> <meta property="og:image" content="https://goblin.technology/fileserver/016T5Q3SQKBT337DAKVSKNXXW1/attachment/original/01J4YBM16ES6C1ENKZC8MC04BD.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:width" content="38"> <meta property="og:image:height" content="49"> <meta property="og:image:alt" content="Avatar for tobi: A 90&#39;s style gif of a black and white skull chattering happily."> <meta property="og:image" content="https://goblin.technology/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01J387PFPNKQWWNY9YQM67WA1T.gif"> <meta property="og:image:type" content="image/gif"> <meta property="og:image:alt" content="Little green peglin goblin bouncing happily."> <meta name="twitter:card" content="summary"> ``` ## 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 <daenney@noreply.codeberg.org> Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
2025-05-08 11:11:25 +00:00
{{- if $m.Width }}
<meta property="og:{{- $m.OGType -}}:width" content="{{ $m.Width }}">
<meta property="og:{{- $m.OGType -}}:height" content="{{ $m.Height }}">
{{- else }}
{{- end }}
{{- if $m.Alt }}
<meta property="og:{{- $m.OGType -}}:alt" content="{{ $m.Alt }}">
{{- else }}
{{- end }}
{{- end }}
{{- if .TwitterSummaryLargeImage }}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{- .TwitterSummaryLargeImage -}}">
{{- if .TwitterImageAlt }}
<meta name="twitter:image:alt" content="{{- .TwitterImageAlt -}}">
{{- else }}
{{- end }}
{{- else }}
<meta name="twitter:card" content="summary">
{{- end }}
{{- end }}