Sha256: be80c555a6f6508b76c59fe8fab225090995ab1cf9c75c6770a07bf09a55e0ed

Contents?: true

Size: 915 Bytes

Versions: 5

Compression:

Stored size: 915 Bytes

Contents

# Encoding: utf-8

module BuntoRedirectFrom
  class RedirectPage < Bunto::Page
    # Initialize a new RedirectPage.
    #
    # site - The Site object.
    # base - The String path to the source.
    # dir  - The String path between the source and the file.
    # name - The String filename of the file.
    def initialize(site, base, dir, name)
      @site = site
      @base = base
      @dir  = dir
      @name = name

      self.process(name)
      self.data = {}
    end

    def generate_redirect_content(item_url)
      self.output = self.content = <<-EOF
<!DOCTYPE html>
<meta charset="utf-8">
<title>Redirecting…</title>
<link rel="canonical" href="#{item_url}">
<meta http-equiv="refresh" content="0; url=#{item_url}">
<h1>Redirecting…</h1>
<a href="#{item_url}">Click here if you are not redirected.</a>
<script>location="#{item_url}"</script>
EOF
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bunto-redirect-from-5.0.0 lib/bunto-redirect-from/redirect_page.rb
bunto-redirect-from-4.0.0 lib/bunto-redirect-from/redirect_page.rb
bunto-redirect-from-3.0.0 lib/bunto-redirect-from/redirect_page.rb
bunto-redirect-from-2.0.0 lib/bunto-redirect-from/redirect_page.rb
bunto-redirect-from-1.0.0 lib/bunto-redirect-from/redirect_page.rb