Ina rite koe ki te whakamahi i a Jekyll hei tuhituhi tuhinga, kāore rawa koe e hiahia ki te whakararuraru i te waihanga ā-ringa i ngā kōnae, te whakarerekē i ngā toronga kōnae, me te tāpiri i te wetereo yml ki te tīmatanga o te tuhinga, tika?
Nō reira, me whakaaro pea koe ki te waihanga i tētahi pou hou ki Jekyll . Hei whakangawari i tēnei katoa, kāore ianei e tika kia tuhia he tuhinga?
Kaua nga kaihōtaka katoa e tuhi waehere kia mangere noa? I tenei wa, ka taea e Rake te whai waahi.
Me pehea te whakamahi i a Jekyll hei whakaputa aunoa i nga tuhinga?
I runga i nga whakaritenga a Jekyll mo te taitara md me te whakatakotoranga yaml, he uaua rawa ki te tuhi a-ringa i te yaml i nga wa katoa, no reira he pai te whiriwhiri ma te whakamahi i nga tuhinga hei whakaputa i nga ihirangi.

Tuatahi, tirohia mena kua whakauruhia te rake:
gem list rake
Mena kaore i whakauruhia, whakauruhia:
gem install rake
Muri iho, hangahia he Rakefile ka tuu ki te raarangi pakiaka o jekyll.
Na, kapehia te waehere e whai ake nei ki te Rakefile:
require 'rake'
require 'yaml'
SOURCE = "."
CONFIG = {
'posts' => File.join(SOURCE, "_posts"),
'post_ext' => "md",
}
# Usage: rake post title="A Title"
desc "Begin a new post in #{CONFIG['posts']}"
task :post do
abort("rake aborted: '#{CONFIG['posts']}' directory not found.") unless FileTest.directory?(CONFIG['posts'])
title = ENV["title"] || "new-post"
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
filename = File.join(CONFIG['posts'], "#{Time.now.strftime('%Y-%m-%d')}-#{slug}.#{CONFIG['post_ext']}")
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
post.puts "---"
post.puts "layout: post"
post.puts "title: \"#{title.gsub(/-/,' ')}\""
post.puts "category: "
post.puts "tags: []"
post.puts "---"
end
end # task :post
- He putanga ngawari noa tenei.
Hei whakamutunga, tomo ki te raina whakahau:
rake post title="article name"
Ma te tangi, ka noho koe ki reira _post I roto i te kōpaki, i kite ahau i tetahi tuhinga hou me te ingoa kōnae年-月-日-文章标题.md.
Ko te tumanako, ka whai hua ki a koe te tuhinga "Me pēhea te whakamahi i a Jekyll hei whakaputa aunoa i ngā wā hanga tuhinga, me te whakanui ngāwari i te auau whakahōu tuhinga?" i tohaina ki te tuhinga a Chen Weiliang ( https://www.chenweiliang.com/ ).
Tukuna mai te hononga o tēnei tuhinga: https://www.chenweiliang.com/cwl-31597.html
