diff --git a/app/helpers/open_graph_helper.rb b/app/helpers/open_graph_helper.rb index ba529c0..81cb0cb 100644 --- a/app/helpers/open_graph_helper.rb +++ b/app/helpers/open_graph_helper.rb @@ -2,10 +2,18 @@ module OpenGraphHelper include Rails.application.routes.url_helpers def set_open_graph_tags(user) + twitter_handle = user.username.downcase + + # Open Graph tags content_for :og_title, user.full_name content_for :og_description, user.description.truncate(160) content_for :og_image, url_for("/uploads/og_images/#{user.username}_og.png") content_for :og_image_alt, "#{user.full_name}'s profile image" content_for :og_url, user_links_url(user.username) + + # Twitter Card tags + content_for :twitter_card, 'summary_large_image' + content_for :twitter_site, "@#{twitter_handle}" + content_for :twitter_creator, "@#{twitter_handle}" end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index faf6057..5e3195a 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -11,18 +11,44 @@ <%= 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: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 %> + + <%= tag.meta name: 'twitter:card', content: 'summary_large_image' %> + <%= 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' %> - <%= tag.meta property: 'og:title', content: content_for?(:og_title) ? content_for(:og_title) : 'Linkarooie - Simplify Your Online Presence' %> - <%= tag.meta property: 'og:description', content: content_for?(:og_description) ? content_for(:og_description) : 'Manage all your links in one place with Linkarooie.' %> - <%= tag.meta property: 'og:image', content: content_for?(:og_image) ? content_for(:og_image) : image_url('default_og_image.png') %> - <%= tag.meta property: 'og:image:alt', content: content_for?(:og_image_alt) ? content_for(:og_image_alt) : 'Default image description' %> - <%= tag.meta property: 'og:url', content: content_for?(:og_url) ? content_for(:og_url) : root_url %> + + <%= 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 %> + + +