File: static_file_ext.rb

package info (click to toggle)
ruby-jekyll-readme-index 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 60 kB
  • sloc: ruby: 91; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 513 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Jekyll
  class StaticFile
    # Convert this static file to a Page
    def to_page
      page = Jekyll::Page.new(@site, @base, @dir, @name)
      page.data["permalink"] = File.dirname(url) + "/"
      page
    end
  end

  class Page
    def update_permalink
      data["permalink"] = File.dirname(url) + "/"
      @url = URL.new(
        :template     => template,
        :placeholders => url_placeholders,
        :permalink    => permalink
      ).to_s
    end
  end
end