Skip to content

Commit aab7b93

Browse files
brunoborgesCopilot
andcommitted
Use per-pattern OG images in slug page meta tags
Replace hardcoded social-card.png with dynamic {{ogImage}} token pointing to og/{category}/{slug}.png for each pattern page. All locales share the same English OG image. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9e41164 commit aab7b93

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

html-generators/generate.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ String generateHtml(Templates tpl, Snippet s, Map<String, Snippet> all, Map<Stri
487487
Map.entry("supportBadge", supportBadge(s.supportState(), extraTokens)),
488488
Map.entry("supportBadgeClass", supportBadgeClass(s.supportState())),
489489
Map.entry("canonicalUrl", canonicalUrl),
490+
Map.entry("ogImage", "%s/og/%s/%s.png".formatted(BASE_URL, s.category(), s.slug())),
490491
Map.entry("flatUrl", "%s/%s.html".formatted(BASE_URL, s.slug())),
491492
Map.entry("titleJson", jsonEscape(s.title())), Map.entry("summaryJson", jsonEscape(s.summary())),
492493
Map.entry("categoryDisplayJson", jsonEscape(s.catDisplay())),

templates/slug-template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
<meta property="og:type" content="article">
2626
<meta property="og:site_name" content="java.evolved">
2727
<meta property="og:locale" content="{{ogLocale}}">
28-
<meta property="og:image" content="https://javaevolved.github.io/images/social-card.png">
28+
<meta property="og:image" content="{{ogImage}}">
2929
<meta property="og:image:width" content="1200">
3030
<meta property="og:image:height" content="630">
3131
<meta property="og:image:type" content="image/png">
3232

3333
<meta name="twitter:card" content="summary_large_image">
3434
<meta name="twitter:title" content="{{title}} | java.evolved">
3535
<meta name="twitter:description" content="{{summary}}">
36-
<meta name="twitter:image" content="https://javaevolved.github.io/images/social-card.png">
36+
<meta name="twitter:image" content="{{ogImage}}">
3737

3838
<script type="application/ld+json">
3939
{

0 commit comments

Comments
 (0)