add open graph and twitter card meta tags
Product pages get og:type=product, og:url, og:image (hero image), and twitter:card=summary_large_image. All other shop pages get og:type=website and twitter:card=summary. og:title and og:description mirror the existing page title and meta description. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,31 @@
|
||||
<.live_title suffix={" · #{@theme_settings.site_name}"}>
|
||||
{assigns[:page_title]}
|
||||
</.live_title>
|
||||
<% og_title =
|
||||
if assigns[:page_title],
|
||||
do: "#{assigns[:page_title]} · #{@theme_settings.site_name}",
|
||||
else: @theme_settings.site_name
|
||||
|
||||
og_description =
|
||||
assigns[:page_description] ||
|
||||
@theme_settings.site_description ||
|
||||
"Welcome to #{@theme_settings.site_name}" %>
|
||||
<meta property="og:site_name" content={@theme_settings.site_name} />
|
||||
<meta property="og:title" content={og_title} />
|
||||
<meta property="og:description" content={og_description} />
|
||||
<meta property="og:type" content={assigns[:og_type] || "website"} />
|
||||
<%= if assigns[:og_url] do %>
|
||||
<meta property="og:url" content={assigns[:og_url]} />
|
||||
<% end %>
|
||||
<%= if assigns[:og_image] do %>
|
||||
<meta property="og:image" content={assigns[:og_image]} />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:image" content={assigns[:og_image]} />
|
||||
<% else %>
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<% end %>
|
||||
<meta name="twitter:title" content={og_title} />
|
||||
<meta name="twitter:description" content={og_description} />
|
||||
<!-- Preload critical fonts for the current typography preset -->
|
||||
<%= for preload <- Berrypod.Theme.Fonts.preload_links(
|
||||
@theme_settings.typography,
|
||||
|
||||
Reference in New Issue
Block a user