File: layout.rb

package info (click to toggle)
ruby-jekyll-redirect-from 0.16.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 284 kB
  • sloc: ruby: 659; sh: 17; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 509 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module JekyllRedirectFrom
  # A stubbed layout for our default redirect template
  # We cannot use the standard Layout class because of site.in_source_dir
  class Layout < Jekyll::Layout
    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
  end
end