nam1962 / returnsworth

Ruby on Rails app & PWA to manage commerce logistics returns
https://returnsworth-0dc66e0a7879.herokuapp.com/
GNU Affero General Public License v3.0
0 stars 1 forks source link

Set Title tag for SEO #23

Closed nam1962 closed 1 year ago

nam1962 commented 1 year ago

https://blog.lewagon.com/skills/setup-meta-tags-rails/

This also learns the use of cover images

nam1962 commented 1 year ago

A cover image is a visual representation of your app that is used when sharing the app on social media platforms. It is important to have a well-designed cover image that accurately represents your app and catches the attention of potential users.

There are many resources available online where you can find examples of cover images for apps. For example, Freepik 12 offers a large collection of free app background and cover art images that you can download and use for inspiration. You can also check out this article from Mockplus 3 that showcases 36 of the best app background design examples.

nam1962 commented 1 year ago

Possible lighter method :

you can populate the meta.yml file with the following information for your Rails app, Eleanor Returnsworth:

meta_product_name: "Eleanor Returnsworth"
meta_title: "Eleanor Returnsworth - E-commerce Returns Coordination"
meta_description: "Eleanor Returnsworth helps coordinate e-commerce client service officers with warehouse operators to monitor product returns efficiently."
meta_image: "eleanor_returnsworth_cover.png" # The image should exist in `app/assets/images/`

To use the meta-tags gem to handle the meta tags for your Rails app, follow these steps:

Add the meta-tags gem to your Gemfile:
# Gemfile
gem 'meta-tags'
Install the gem by running `bundle install`.

Configure the meta-tags gem settings in an initializer:
# config/initializers/meta_tags.rb
MetaTags.configure do |c|
  c.title_limit        = 70
  c.description_limit  = 160
  c.keywords_limit     = 255
  c.keywords_separator = ', '
end
Include the display_meta_tags method in your layout file:
# views/layouts/application.html.erb
<head>
  <%= display_meta_tags %>
  ...
</head>
Define a helper method with your default meta tags:
# app/helpers/application_helper.rb
module ApplicationHelper
  def default_meta_tags
    {
      site: 'Eleanor Returnsworth',
      title: meta_title,
      description: meta_description,
      image: meta_image,
      og: {
        title: meta_title,
        description: meta_description,
        type: 'website',
        url: request.original_url,
        image: image_url(meta_image)
      }
    }
  end

  def meta_title
    "Eleanor Returnsworth - E-commerce Returns Coordination"
  end

  def meta_description
    "Eleanor Returnsworth helps coordinate e-commerce client service officers with warehouse operators to monitor product returns efficiently."
  end

  def meta_image
    "eleanor_returnsworth_cover.png"
  end
end
Use the default_meta_tags helper method in your layout file:

views/layouts/application.html.erb

<%= display_meta_tags(default_meta_tags) %> ...
If you want to set custom meta tags for specific pages, use the set_meta_tags method in your views:

<% set_meta_tags title: 'Custom Title', description: 'Custom description for this page' %>

These steps will set up your Rails app with the desired meta tags for SEO optimization.