class Middleman::Sitemap::Extensions::Redirects::RedirectResource

Attributes

output[RW]

Public Class Methods

new(store, path, target) click to toggle source
Calls superclass method Middleman::Sitemap::Resource::new
# File lib/middleman-core/sitemap/extensions/redirects.rb, line 63
def initialize(store, path, target)
  @request_path = target

  super(store, path)
end

Public Instance Methods

binary?() click to toggle source

def request_path

@request_path

end

# File lib/middleman-core/sitemap/extensions/redirects.rb, line 100
def binary?
  false
end
ignored?() click to toggle source
# File lib/middleman-core/sitemap/extensions/redirects.rb, line 108
def ignored?
  false
end
metadata() click to toggle source
# File lib/middleman-core/sitemap/extensions/redirects.rb, line 112
def metadata
  @local_metadata.dup
end
raw_data() click to toggle source
# File lib/middleman-core/sitemap/extensions/redirects.rb, line 104
def raw_data
  {}
end
render(*) click to toggle source
# File lib/middleman-core/sitemap/extensions/redirects.rb, line 73
          def render(*)
            url = ::Middleman::Util.url_for(store.app, @request_path,
                                            relative: false,
                                            find_resource: true
            )

            if output
              output.call(path, url)
            else
              <<-END
                <html>
                  <head>
                    <meta http-equiv=refresh content="0; url=#{url}" />
                    <meta name="robots" content="noindex,follow" />
                    <meta http-equiv="cache-control" content="no-cache" />
                  </head>
                  <body>
                  </body>
                </html>
              END
            end
          end
template?() click to toggle source
# File lib/middleman-core/sitemap/extensions/redirects.rb, line 69
def template?
  true
end