Class: JekyllRedirectFrom::Layout

Inherits:
Jekyll::Layout
  • Object
show all
Defined in:
lib/jekyll-redirect-from/layout.rb

Overview

A stubbed layout for our default redirect template We cannot use the standard Layout class because of site.in_source_dir

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ Layout

Returns a new instance of Layout.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jekyll-redirect-from/layout.rb', line 7

def initialize(site)
  @site = site
  @base = __dir__
  @name = "redirect.html"
  @path = File.expand_path(@name, @base)
  @relative_path = "_layouts/redirect.html"

  self.data = {}
  self.ext = "html"
  self.content = File.read(@path)
end