philomena/lib/philomena_web/templates/layout/_opengraph.html.slime
2024-05-20 19:04:12 +02:00

45 lines
1.8 KiB
Text

meta name="generator" content="philomena"
meta name="theme-color" content="#618fc3"
meta name="format-detection" content="telephone=no"
= if opengraph?(@conn) do
- image = @conn.assigns.image
- filtered = not image.thumbnails_generated
- description = "##{image.id} - #{Philomena.Images.tag_list(image)} - #{site_name()}"
- thumb_large = ImageView.thumb_urls(image, false)[:large]
- thumb_rendered = ImageView.thumb_url(image, false, :rendered)
meta name="keywords" content=tag_list(image)
meta name="description" content=description
meta property="og:title" content=description
meta property="og:url" content=Routes.image_url(@conn, :show, image)
= for tag <- artist_tags(image.tags) do
meta property="dc:creator" content=tag.name_in_namespace
= if image_has_sources(image) do
meta property="foaf:primaryTopic" content=image_first_source(image)
link rel="alternate" type="application/json+oembed" href=Routes.api_json_oembed_url(@conn, :index, url: Routes.image_path(@conn, :show, image)) title="oEmbed JSON Profile"
link rel="canonical" href=Routes.image_url(@conn, :show, image)
= cond do
- image.image_mime_type == "video/webm" and not filtered ->
meta property="og:type" content="video.other"
meta property="og:image" content=thumb_rendered
meta property="og:video" content=thumb_large
- image.image_mime_type == "image/svg+xml" and not filtered ->
meta property="og:type" content="website"
meta property="og:image" content=thumb_rendered
- not filtered ->
meta property="og:type" content="website"
meta property="og:image" content=thumb_large
- true ->
meta property="og:type" content="website"
- else
meta name="description" content=gettext("%{site_name} is a linear imagebooru which lets you share, find and discover new art and media.", site_name: site_name())