logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

rel_me.ex (584B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.Metadata.Providers.RelMe do
  5. alias Pleroma.Web.Metadata.Providers.Provider
  6. @behaviour Provider
  7. @impl Provider
  8. def build_tags(%{user: user}) do
  9. bio_tree = Floki.parse_fragment!(user.bio)
  10. (Floki.attribute(bio_tree, "link[rel~=me]", "href") ++
  11. Floki.attribute(bio_tree, "a[rel~=me]", "href"))
  12. |> Enum.map(fn link ->
  13. {:link, [rel: "me", href: link], []}
  14. end)
  15. end
  16. end