Sha256: 5a60df26616204ee4b7255f5f21f78880bb2bade9dec65e6e80c85d415f7d4f7

Contents?: true

Size: 947 Bytes

Versions: 2

Compression:

Stored size: 947 Bytes

Contents

module Cortex
  module Snippets
    module ViewHelpers
      def snippet(options = {}, &block)
        snippet = webpage[:snippets].find { |snippet| snippet.name == options[:id] }

        if snippet.empty?
          content_tag(:snippet, capture(&block), id: options[:id])
        else
          content_tag(:snippet, snippet, id: options[:id])
        end
      end

      def seo_title
        webpage[:seo_title]
      end

      def seo_description
        webpage[:seo_description]
      end

      def noindex
        webpage[:noindex]
      end

      def nofollow
        webpage[:nofollow]
      end

      def noodp
        webpage[:noodp]
      end

      def nosnippet
        webpage[:nosnippet]
      end

      def noarchive
        webpage[:noarchive]
      end

      def noimageindex
        webpage[:noimageindex]
      end

      private

      def webpage
        Client::current_webpage(request)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cortex-snippets-client-ruby-0.1.1 lib/cortex/snippets/view_helpers.rb
cortex-snippets-client-ruby-0.1.0 lib/cortex/snippets/view_helpers.rb