From 0a4a6a225731f18ea421e325bbdb98b011699e03 Mon Sep 17 00:00:00 2001 From: Albert Volkman Date: Sat, 18 Feb 2017 10:22:04 -0500 Subject: [PATCH] [#17] Add metadata for sources --- _plugins/jekyll_get.rb | 9 +++++++++ jekyll_get.rb | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/_plugins/jekyll_get.rb b/_plugins/jekyll_get.rb index f5fb7e3..298679e 100644 --- a/_plugins/jekyll_get.rb +++ b/_plugins/jekyll_get.rb @@ -19,6 +19,15 @@ def generate(site) begin target = site.data[d['data']] source = JSON.load(open(d['json'])) + + if d['meta'] + meta = d['meta'] + + source['items'].each { |item| + item['meta'] = meta + } + end + if target HashJoiner.deep_merge target, source else diff --git a/jekyll_get.rb b/jekyll_get.rb index f5fb7e3..298679e 100644 --- a/jekyll_get.rb +++ b/jekyll_get.rb @@ -19,6 +19,15 @@ def generate(site) begin target = site.data[d['data']] source = JSON.load(open(d['json'])) + + if d['meta'] + meta = d['meta'] + + source['items'].each { |item| + item['meta'] = meta + } + end + if target HashJoiner.deep_merge target, source else