Sha256: 6b2ded8f29fc5eb542bb5d1a1bd1a0d8c1a3b7b61b36671c23c98e9627d3a6e2

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 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)
        app.current_path = destination_path
        %[
          <html>
            <head>
              <link rel="canonical" href="#{app.url_for(@alias_resource)}" />
              <meta name="robots" content="noindex,follow" />
              <meta http-equiv="cache-control" content="no-cache" />
              <script>
                // Attempt to keep search and hash
                window.location.replace("#{app.url_for(@alias_resource)}"+window.location.search+window.location.hash);
              </script>
              <meta http-equiv=refresh content="0; url=#{app.url_for(@alias_resource)}" />
            </head>
            <body>
              <a href="#{app.url_for(@alias_resource)}">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.16 lib/middleman-alias/alias-resource.rb