Sha256: 6ec843eb02a3a8a5ae90b25be55cf9d0d65a78f28a35822112d936b4531595bd

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

module Middleman
  module Sitemap
    class AliasResource < ::Middleman::Sitemap::Resource

      attr_accessor :output

      def initialize(store, path, alias_resource)
        @alias_resource = alias_resource
        super(store, path)
      end

      def source_file
        @alias_resource.source_file
      end

      def template?
        false
      end

      def render(*args, &block)
        new_url = ::Middleman::Util.url_for(@app, @alias_resource, {current_resource: self})
        %[
          <html>
            <head>
              <link rel="canonical" href="#{new_url}" />
              <meta name="robots" content="noindex,follow" />
              <meta http-equiv="cache-control" content="no-cache" />
              <script>
                // Attempt to keep search and hash
                window.location.replace("#{new_url}"+window.location.search+window.location.hash);
              </script>
              <meta http-equiv=refresh content="0; url=#{new_url}" />
            </head>
            <body>
              <a href="#{new_url}">You are being redirected.</a>
            </body>
          </html>
        ]
      end

      def binary?
        false
      end

      def raw_data
        @alias_resource.raw_data
      end

      def ignored?
        false
      end

      def metadata
        @alias_resource.metadata
      end


    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-alias-0.0.17 lib/middleman-alias/alias-resource.rb