kpumuk / meta-tags

Search Engine Optimization (SEO) for Ruby on Rails applications.
MIT License
2.73k stars 275 forks source link

Generated initializer has a duplicate entry #295

Closed pil0u closed 6 months ago

pil0u commented 6 months ago

Hello,

Quite curious, when I run rails generate meta_tags:install, the generated file is:

# Use this setup block to configure all options available in MetaTags.
MetaTags.configure do |config|
  # How many characters should the title meta tag have at most. Default is 70.
  # Set to nil or 0 to remove limits.
  # config.title_limit = 70

  # When true, site title will be truncated instead of title. Default is false.
  # config.truncate_site_title_first = false

  # Add HTML attributes to the <title> HTML tag. Default is {}.
  # config.title_tag_attributes = {}

  # Add HTML attributes to the <title> HTML tag. Default is {}.          <-------- duplicate
  # config.title_tag_attributes = {}

  # Maximum length of the page description. Default is 300.
  # Set to nil or 0 to remove limits.
  # config.description_limit = 300

  # Maximum length of the keywords meta tag. Default is 255.
  # config.keywords_limit = 255

  # Default separator for keywords meta tag (used when an Array passed with
  # the list of keywords). Default is ", ".
  # config.keywords_separator = ', '

  # When true, keywords will be converted to lowercase, otherwise they will
  # appear on the page as is. Default is true.
  # config.keywords_lowercase = true

  # When true, the output will not include new line characters between meta tags.
  # Default is false.
  # config.minify_output = false

  # When false, generated meta tags will be self-closing (<meta ... />) instead
  # of open (`<meta ...>`). Default is true.
  # config.open_meta_tags = true

  # List of additional meta tags that should use "property" attribute instead
  # of "name" attribute in <meta> tags.
  # config.property_tags.push(
  #   'x-hearthstone:deck',
  # )
end

Notice the duplicate. I have had a quick look at the source code, but I cannot find why this would happen. If you point me in the right direction, I could open a PR.

Ruby 3.3.0 Rails 7.1.3.2 meta-tags 2.20.0

kpumuk commented 6 months ago

It was addressed in https://github.com/kpumuk/meta-tags/commit/04ec421dfe75e9358b3b0107fbb5f4eb2b093b75, but never released. Let me cut a new release to fix it :-)

kpumuk commented 6 months ago

The fix released in 2.21.0

pil0u commented 6 months ago

Ha that's why I couldn't see the issue in main, should have looked better. Grand, thanks @kpumuk!