Sha256: 268cb75f979a6305323b65d8f1182c629ca4cc7af7321547757af20feab3a745

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module JekyllRedirectFrom
  class RedirectPage < Jekyll::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>
      <html>
      <head>
      <title>Redirecting...</title>
      <link rel="canonical" href="#{item_url}"/>
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
      <meta http-equiv="refresh" content="0; url=#{item_url}" />
      </head>
      <body>
        <p><strong>Redirecting...</strong></p>
        <p><a href='#{item_url}'>Click here if you are not redirected.</a></p>
        <script>
          document.location.href = "#{item_url}";
        </script>
      </body>
      </html>
      EOF
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jekyll-redirect-from-0.3.1 lib/jekyll-redirect-from/redirect_page.rb
jekyll-redirect-from-0.3.0 lib/jekyll-redirect-from/redirect_page.rb
jekyll-redirect-from-0.2.0 lib/jekyll-redirect-from/redirect_page.rb