Sha256: c2b409a3fbaf20ee7933b38d22ee36eaf211b99171d5d9d2df61ba0819ebec0b

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

module Jekyll
  class RedirectFrom < Generator
    class RedirectPage < 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)
      end

      def generate_redirect_content(item_url)
        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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-redirect-from-0.1.0 lib/jekyll/redirect_from/redirect_page.rb