From 4789d8aef94a275c94dcd57d821fd7dc6ff628ff Mon Sep 17 00:00:00 2001 From: Dean Lofts Date: Tue, 10 Dec 2024 10:01:51 +1100 Subject: [PATCH] last fix --- app/helpers/open_graph_helper.rb | 2 +- app/views/layouts/application.html.erb | 69 +++++++++++++++++--------- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/app/helpers/open_graph_helper.rb b/app/helpers/open_graph_helper.rb index c9d58ae..1cdf5da 100644 --- a/app/helpers/open_graph_helper.rb +++ b/app/helpers/open_graph_helper.rb @@ -5,7 +5,7 @@ module OpenGraphHelper def set_open_graph_tags(user) default_title = 'Linkarooie - Simplify Your Online Presence' default_description = 'Manage all your links in one place with Linkarooie.' - default_image = image_url('default_og_image.png') + default_image = 'https://linkarooie.syd1.digitaloceanspaces.com/defaults/default_og_image.png' content_for :og_title, user.full_name.presence || default_title content_for :og_description, user.description.presence&.truncate(160) || default_description diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9b85ace..4b32157 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,46 +10,67 @@ <%= vite_client_tag %> <%= vite_javascript_tag 'application' %> - + + <%= tag.meta property: 'og:type', content: 'website' %> <%= tag.meta property: 'og:site_name', content: 'Linkarooie' %> <%= tag.meta property: 'og:locale', content: 'en_US' %> - <%= tag.meta property: 'og:updated_time', content: '2024-08-08T12:00:19Z' %> + <%= tag.meta property: 'og:updated_time', content: Time.current.iso8601 %> + + <% if content_for?(:og_title) %> + <%= tag.meta property: 'og:title', content: content_for(:og_title) %> + <% else %> + <%= tag.meta property: 'og:title', content: 'Linkarooie - Simplify Your Online Presence' %> + <% end %> + + <% if content_for?(:og_description) %> + <%= tag.meta property: 'og:description', content: content_for(:og_description) %> + <% else %> + <%= tag.meta property: 'og:description', content: 'Manage all your links in one place with Linkarooie. Create a central hub for your social and professional profiles.' %> + <% end %> - <%= tag.meta property: 'og:title', content: 'Linkarooie - Simplify Your Online Presence' %> - <%= tag.meta property: 'og:description', content: 'Manage all your links in one place with Linkarooie. Create a central hub for your social and professional profiles.' %> - <%= tag.meta property: 'og:image', content: image_url('default_og_image.png') %> - <%= tag.meta property: 'og:image:alt', content: 'Linkarooie logo' %> - <%= tag.meta property: 'og:url', content: root_url %> + <% if content_for?(:og_image) %> + <%= tag.meta property: 'og:image', content: content_for(:og_image) %> + <% else %> + <%= tag.meta property: 'og:image', content: 'https://linkarooie.syd1.digitaloceanspaces.com/defaults/default_og_image.png' %> + <% end %> - - <%= tag.meta name: 'twitter:card', content: content_for?(:og_image) ? content_for(:og_image) : image_url('default_og_image.png') %> - <%= tag.meta name: 'twitter:title', content: 'Linkarooie - Simplify Your Online Presence' %> - <%= tag.meta name: 'twitter:description', content: 'Manage all your links in one place with Linkarooie. Create a central hub for your social and professional profiles.' %> - <%= tag.meta name: 'twitter:image', content: image_url('default_og_image.png') %> - <%= tag.meta name: 'twitter:image:alt', content: 'Linkarooie logo' %> - <%= tag.meta name: 'twitter:site', content: '@loftwah' %> - <%= tag.meta name: 'twitter:creator', content: '@loftwah' %> + <% if content_for?(:og_url) %> + <%= tag.meta property: 'og:url', content: content_for(:og_url) %> + <% else %> + <%= tag.meta property: 'og:url', content: request.original_url %> + <% end %> + + + <%= tag.meta name: 'twitter:card', content: content_for(:twitter_card) || 'summary_large_image' %> + <%= tag.meta name: 'twitter:title', content: content_for(:og_title) || 'Linkarooie - Simplify Your Online Presence' %> + <%= tag.meta name: 'twitter:description', content: content_for(:og_description) || 'Manage all your links in one place with Linkarooie.' %> + <%= tag.meta name: 'twitter:image', content: content_for(:og_image) || 'https://linkarooie.syd1.digitaloceanspaces.com/defaults/default_og_image.png' %> + <%= tag.meta name: 'twitter:image:alt', content: 'Linkarooie profile image' %> + <% if content_for?(:twitter_site) %> + <%= tag.meta name: 'twitter:site', content: content_for(:twitter_site) %> + <%= tag.meta name: 'twitter:creator', content: content_for(:twitter_creator) %> + <% end %> - <%= tag.meta name: 'description', content: 'Linkarooie helps you manage all your links in one place, making it easy to simplify your online presence and create a central hub for your social and professional profiles.' %> - <%= tag.link rel: 'canonical', href: root_url %> + <%= tag.meta name: 'description', content: content_for(:og_description) || 'Linkarooie helps you manage all your links in one place, making it easy to simplify your online presence and create a central hub for your social and professional profiles.' %> + <%= tag.link rel: 'canonical', href: content_for(:og_url) || request.original_url %> - +