zoukankan      html  css  js  c++  java
  • 使用jekyll主题

    github上面有很多基于jekyll的主题

    https://github.com/theme4jekyll

    使用起来也非常方便。直接clone到本地

    这些主题,包括了很多模板,在新建博客的时候可以在开头需要写一些标签,如果为了方便的话,提前写好一个程序来完成将会变得非常方便。

    比如我写了一个。这个就在主题文件夹下面(newPost.rb)

     1 time = Time.new
     2 timestr = time.strftime("%Y-%m-%d-")
     3 puts "title: "
     4 title = gets.chomp!
     5 puts "dir: "
     6 dir = gets.chomp!
     7 puts "tags: "
     8 tags = gets.chomp!
     9 str = <<here
    10 ---
    11 layout: post
    12 title: #{title}
    13 modified:
    14 categories: #{dir}
    15 description:
    16 tags: [#{tags}]
    17 image:
    18   feature: abstract-5.jpg
    19   credit:
    20   creditlink:
    21 comments: false
    22 share: false
    23 ---
    24 here
    25 
    26 dir = File.join("_posts",dir)
    27 puts dir
    28 Dir.mkdir(dir) unless File.exist?(dir)
    29 filename = File.join(dir,timestr + title + ".md")
    30 File.open(filename,"w+"){|file|
    31   file.puts str
    32 }

    这样每次要新建一篇文章的时候就可以使用ruby newPost.rb,然后输入title,dir,tags等就会在相应的位置生成一个带头的文本了。

    当然使用其它的任何语言都可以。而且如果你的文本编辑器可以保存头,那么就更方便了。

  • 相关阅读:
    jsp转向
    什么是 XDoclet?
    tomcat中的几点配置说明
    mysql5问题
    POJ 3734 Blocks
    POJ 2409 Let it Bead
    HDU 1171 Big Event in HDU
    POJ 3046 Ant Counting
    HDU 2082 找单词
    POJ 1286 Necklace of Beads
  • 原文地址:https://www.cnblogs.com/wenning/p/4891173.html
Copyright © 2011-2022 走看看