Skip to content

Commit

Permalink
feat: Handle resource copying to avoid conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
strogonoff committed Aug 18, 2019
1 parent a020700 commit 615f614
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/jekyll-theme-isotc211-helpers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'jekyll-theme-isotc211-helpers/resource_listing'
require 'jekyll-theme-isotc211-helpers/resource_copy'


module Jekyll
Expand Down
13 changes: 13 additions & 0 deletions lib/jekyll-theme-isotc211-helpers/resource_copy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copies resource contents as is to site destination, bypassing Jekyll’s conversion

Jekyll::Hooks.register :site, :post_write do |site|
if site.config.key?('resource_listings')
site.config['resource_listings'].each do |listing_id, cfg|
copy_resource_contents(cfg, site.config['destination'])
end
end
end

def copy_resource_contents(resource_cfg, site_dest)
FileUtils.cp_r("#{resource_cfg['resource_root']}/.", "#{site_dest}/#{resource_cfg['index_url']}")
end

0 comments on commit 615f614

Please sign in to comment.