Sha256: f1637780f2dfe376b2e0ec6fdac2b94ff42fdd10c35e92e3721967f795c944ac

Contents?: true

Size: 987 Bytes

Versions: 27

Compression:

Stored size: 987 Bytes

Contents

# frozen_string_literal: true

module Shimmer
  class Meta
    class_attribute :app_name
    attr_accessor :title, :description, :image, :canonical

    def tags
      tags = []
      title = self.title.present? ? "#{self.title} | #{app_name}" : app_name
      tags.push(type: :title, value: title)
      tags.push(property: "og:title", content: title)
      if description.present?
        tags.push(name: :description, content: description)
        tags.push(property: "og:description", content: description)
      end
      if image.present?
        tags.push(property: "og:image", content: image)
      end
      if canonical.present?
        tags.push(type: :link, rel: :canonical, href: canonical)
        tags.push(property: "og:url", content: canonical)
      end
      tags.push(property: "og:type", content: :website)
      tags.push(property: "og:locale", content: I18n.locale)
      tags.push(name: "twitter:card", content: :summary_large_image)
      tags
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
shimmer-0.0.41 lib/shimmer/utils/meta.rb
shimmer-0.0.40 lib/shimmer/utils/meta.rb
shimmer-0.0.39 lib/shimmer/utils/meta.rb
shimmer-0.0.38 lib/shimmer/utils/meta.rb
shimmer-0.0.37 lib/shimmer/utils/meta.rb
shimmer-0.0.36 lib/shimmer/utils/meta.rb
shimmer-0.0.35 lib/shimmer/utils/meta.rb
shimmer-0.0.34 lib/shimmer/utils/meta.rb
shimmer-0.0.33 lib/shimmer/utils/meta.rb
shimmer-0.0.32 lib/shimmer/utils/meta.rb
shimmer-0.0.31 lib/shimmer/utils/meta.rb
shimmer-0.0.30 lib/shimmer/utils/meta.rb
shimmer-0.0.29 lib/shimmer/utils/meta.rb
shimmer-0.0.28 lib/shimmer/utils/meta.rb
shimmer-0.0.27 lib/shimmer/utils/meta.rb
shimmer-0.0.26 lib/shimmer/utils/meta.rb
shimmer-0.0.25 lib/shimmer/utils/meta.rb
shimmer-0.0.24 lib/shimmer/utils/meta.rb
shimmer-0.0.23 lib/shimmer/utils/meta.rb
shimmer-0.0.22 lib/shimmer/utils/meta.rb