Skip to content

Commit

Permalink
RSS: add "tag" option to add a tag to all posts (#306)
Browse files Browse the repository at this point in the history
Merge pull request 306
  • Loading branch information
sergiocarracedo authored and jekyllbot committed Nov 6, 2017
1 parent 0c2e063 commit 58a8395
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ doc/

.DS_Store
Gemfile.lock

3 changes: 3 additions & 0 deletions lib/jekyll-import/importers/rss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Importers
class RSS < Importer
def self.specify_options(c)
c.option "source", "--source NAME", "The RSS file or URL to import"
c.option "tag", "--tag NAME", "Add a tag to posts"
end

def self.validate(options)
Expand Down Expand Up @@ -48,6 +49,8 @@ def self.process(options)
"title" => item.title,
}

header["tag"] = options["tag"] if !options.to_s.empty?

FileUtils.mkdir_p("_posts")

File.open("_posts/#{name}.html", "w") do |f|
Expand Down

0 comments on commit 58a8395

Please sign in to comment.