Skip to content

Commit 8c90c8d

Browse files
authored
feat: use banner image of success story as social media image (#2864)
1 parent 028a909 commit 8c90c8d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/ocamlorg_frontend/layouts/layout.eml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ let subnav_tabs
99
let first_section = List.hd sections in
1010
let breadcrumb_options current =
1111
let selected_option section = if section = current then "selected" else "" in
12-
let options_list option =
12+
let options_list option =
1313
<option value="<%s url_of_section option %>" <%s selected_option option %>>
1414
<%s title_of_section option %>
15-
</option>
15+
</option>
1616
in
1717
<nav aria-label="breadcrumbs" class="px-4 flex bg-title dark:bg-[#111827] text-white dark:text-dark-title md:hidden">
1818
<ul>
19-
<li class="inline-block">
19+
<li class="inline-block">
2020
<a href="<%s url_of_section first_section %>" class="flex items-center px-2 py-2 border-transparent border-2 border-b-4"> <%s title %>
2121
<span> <%s! Icons.chevron_right "w-3 h-3 ml-2" %> </span> </a>
2222
</li>
@@ -47,13 +47,20 @@ let base
4747
?(use_swiper=false)
4848
?(banner = false)
4949
?description
50+
?social_media_image
5051
?styles
5152
~title
5253
?canonical
5354
?alternate
5455
?(active_top_nav_item: Header.nav_item option)
5556
?(footer_html = "")
5657
inner =
58+
let social_media_image_url =
59+
"https://ocaml.org" ^
60+
match social_media_image with
61+
| None -> Ocamlorg_static.Asset.url "ocaml_org_social_media.png"
62+
| Some path -> path
63+
in
5764
<!DOCTYPE html>
5865
<html lang="en">
5966
<head id="htmx-head">
@@ -66,14 +73,14 @@ inner =
6673
<% (match description with | Some description -> %>
6774
<meta name="twitter:description" content="<%s description %>">
6875
<% | None -> ()); %>
69-
<meta name="twitter:image" content="https://ocaml.org<%s Ocamlorg_static.Asset.url "ocaml_org_social_media.png" %>">
76+
<meta name="twitter:image" content="<%s social_media_image_url %>">
7077
<meta property="og:site_name" content="OCaml">
7178
<meta property="og:type" content="object">
7279
<meta property="og:title" content="<%s title %>">
7380
<% (match description with | Some description -> %>
7481
<meta property="og:description" content="<%s description %>">
7582
<% | None -> ()); %>
76-
<meta name="og:image" content="https://ocaml.org<%s Ocamlorg_static.Asset.url "ocaml_org_social_media.png" %>">
83+
<meta name="og:image" content="<%s social_media_image_url %>">
7784
<meta name="theme-color" content="#fff" >
7885
<meta name="color-scheme" content="white">
7986
<% (match canonical with | Some canonical -> %>

src/ocamlorg_frontend/pages/success_story.eml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ let render (story : Data.Success_story.t) =
22
Layout.render
33
~title:(Printf.sprintf "%s · Success Stories" story.title)
44
~description:story.synopsis
5+
~social_media_image:(Ocamlorg_static.Media.url story.background)
56
~canonical:(Url.success_story story.slug) @@
67
<div class="intro-section-simple dark:dark-intro-section-simple">
78
<div class="container-fluid">

0 commit comments

Comments
 (0)