Class: Jekyll::Reading::Generator

Inherits:
Generator
  • Object
show all
Defined in:
lib/ext.rb

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/ext.rb', line 398

def generate(site)
  $g_config = Jekyll::sites[0].config
  if !File.directory?("tags")
    Dir.mkdir "tags"
  end
  reading = site.tags.keys


  for tag in reading
    tagpath = "tags/#{tag}.md"
    if !File.file?(tagpath)
      $auto_gen_tag_flag += 1
      tagTmp = <<EOF
---
layout: tagpage
title: 'Tag: #{tag}'
tag: #{tag}
---
EOF

      File.open(tagpath , 'w+')  { |f| f.write(tagTmp) }
      print tagpath," "


    end


  end

end