Skip to content

Commit a9f2227

Browse files
committed
add source ref for inlined plugin postfiles
1 parent 88cf393 commit a9f2227

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

_plugins/postfiles.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
# Ref: https://github.com/indirect/jekyll-postfiles/blob/master/_plugins/postfiles.rb
12
module Jekyll
2-
3+
34
# StaticFile subclass that properly translates paths
45
class PostFile < StaticFile
56
def path
@@ -23,9 +24,9 @@ def generate(site)
2324
postfile_id = post.id.gsub(/[\s\w\/%]*(\d{4})\/(\d\d)\/(\d\d)\/(.*)/, '\1-\2-\3-\4')
2425
# Get the directory that files from this post would be in
2526
postfile_dir = File.join(site.config['source'], '_postfiles', postfile_id)
26-
27+
2728
# Add a static file entry for each postfile, if any
28-
Dir[File.join(postfile_dir, '/*')].each do |pf|
29+
Dir[File.join(postfile_dir, '/*')].each do |pf|
2930
site.static_files << PostFile.new(site, postfile_dir, CGI.unescape(post.url), File.basename(pf))
3031
end
3132
end
@@ -46,4 +47,4 @@ def render(context)
4647
end
4748
end
4849

49-
Liquid::Template.register_tag('postfile', Jekyll::PostfileTag)
50+
Liquid::Template.register_tag('postfile', Jekyll::PostfileTag)

0 commit comments

Comments
 (0)