Module: JekyllRedirectFrom::Redirectable

Defined in:
lib/jekyll-redirect-from/redirectable.rb

Overview

Module which can be mixed in to documents (and pages) to provide redirect_to and redirect_from helpers

Instance Method Summary collapse

Instance Method Details

#redirect_fromObject

Returns an array representing the relative paths to other documents which should be redirected to this document



19
20
21
22
23
24
25
# File 'lib/jekyll-redirect-from/redirectable.rb', line 19

def redirect_from
  if to_liquid["redirect_from"].is_a?(Array)
    to_liquid["redirect_from"].compact
  else
    [to_liquid["redirect_from"]].compact
  end
end

#redirect_toObject

Returns a string representing the relative path or URL to which the document should be redirected



9
10
11
12
13
14
15
# File 'lib/jekyll-redirect-from/redirectable.rb', line 9

def redirect_to
  if to_liquid["redirect_to"].is_a?(Array)
    to_liquid["redirect_to"].compact.first
  else
    to_liquid["redirect_to"]
  end
end