mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 16:40:29 +00:00
Use object url instead of a hack
This commit is contained in:
parent
fd3a558230
commit
0256bd2f1d
1 changed files with 5 additions and 13 deletions
|
@ -3,13 +3,13 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
|
defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
|
||||||
alias Pleroma.Web.Metadata.Providers.Provider
|
alias Pleroma.Web.Metadata.Providers.Provider
|
||||||
alias Pleroma.{HTML, Formatter, User, Web}
|
alias Pleroma.{HTML, Formatter, User}
|
||||||
alias Pleroma.Web.MediaProxy
|
alias Pleroma.Web.MediaProxy
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
|
|
||||||
@impl Provider
|
@impl Provider
|
||||||
def build_tags(%{activity: activity, user: user}) do
|
def build_tags(%{activity: %{data: %{"object" => %{"id" => object_id}}} = activity, user: user}) do
|
||||||
attachments = build_attachments(activity)
|
attachments = build_attachments(activity)
|
||||||
|
|
||||||
# Most previews only show og:title which is inconvenient. Instagram
|
# Most previews only show og:title which is inconvenient. Instagram
|
||||||
|
@ -22,21 +22,13 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
|
||||||
{:meta,
|
{:meta,
|
||||||
[
|
[
|
||||||
property: "og:title",
|
property: "og:title",
|
||||||
content:
|
content: "#{user.name}: " <> "“" <> scrub_html_and_truncate(activity) <> "”"
|
||||||
"#{user.name}: " <>
|
|
||||||
"“" <>
|
|
||||||
scrub_html_and_truncate(activity) <>
|
|
||||||
"”"
|
|
||||||
], []},
|
], []},
|
||||||
{:meta, [property: "og:url", content: "#{Web.base_url()}/notice/#{activity.id}"], []},
|
{:meta, [property: "og:url", content: object_id], []},
|
||||||
{:meta,
|
{:meta,
|
||||||
[
|
[
|
||||||
property: "og:description",
|
property: "og:description",
|
||||||
content:
|
content: "#{user_name_string(user)}: " <> "“" <> scrub_html_and_truncate(activity) <> "”"
|
||||||
"#{user_name_string(user)}: " <>
|
|
||||||
"“" <>
|
|
||||||
scrub_html_and_truncate(activity) <>
|
|
||||||
"”"
|
|
||||||
], []},
|
], []},
|
||||||
{:meta, [property: "og:type", content: "website"], []}
|
{:meta, [property: "og:type", content: "website"], []}
|
||||||
] ++
|
] ++
|
||||||
|
|
Loading…
Reference in a new issue