Class: Jekyll::AltUrls::RedirectPage

Inherits:
Page
  • Object
show all
Defined in:
lib/jekyll/alt_urls/redirect_page.rb

Instance Method Summary collapse

Constructor Details

#initialize(site, base, dir, name) ⇒ RedirectPage

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.



10
11
12
13
14
15
16
17
# File 'lib/jekyll/alt_urls/redirect_page.rb', line 10

def initialize(site, base, dir, name)
  @site = site
  @base = base
  @dir  = dir
  @name = name

  self.process(name)
end

Instance Method Details

#generate_redirect_content(item_url) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/jekyll/alt_urls/redirect_page.rb', line 19

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