Sha256: 2c882a50601c27ba8a11fa6dac2c312973fc56cc74b44f3694355cb257117c72

Contents?: true

Size: 621 Bytes

Versions: 27

Compression:

Stored size: 621 Bytes

Contents

# frozen_string_literal: true

module Shimmer
  module MetaHelper
    def meta
      @meta ||= Meta.new.tap do |meta|
        meta.canonical = url_for(only_path: false)
      end
    end

    def title(value)
      meta.title = value
    end

    def description(value)
      meta.description = value
    end

    def image(value)
      meta.image = image_file_url(value, width: 1200)
    end

    def render_meta
      tags = meta.tags.map do |tag|
        type = tag.delete(:type) || "meta"
        value = tag.delete(:value)
        content_tag(type, value, tag)
      end
      safe_join tags, "\n"
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

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