page version: April 8, 2023
this jekyll site's _plugins
this page is generated by the plugin source below:
no_date.rb
# https://stackoverflow.com/a/68287682
class Jekyll::PostReader
# monkey patch `Jekyll::PostReader::read_posts` so we don't have to write the
# date in the post filename
#
# see the jekyll source
def read_posts(dir)
read_publishable(dir, "_posts", Jekyll::Document::DATELESS_FILENAME_MATCHER)
end
end
hook-jekyll-version.rb
# variables I want in my posts
# (I wish I could write the ruby directly in the page sources.)
Jekyll::Hooks.register :site, :after_init do |site|
site.config['ruby-version'] = RUBY_DESCRIPTION
site.config['jekyll-version'] = Gem.loaded_specs['jekyll'].version.version
end
hook-_plugins.rb
# automatically build the content about this site's _plugins
Jekyll::Hooks.register :site, :after_init do |site|
acc = []
Dir.each_child("_plugins"){ |filename|
acc.push("## #{filename}\n#{(File.readlines(File.join("_plugins", filename)).map {|line| " #{line}"}).join()}\n")
}
site.config['about-_plugins'] = "this page is generated by the plugin source below:\n#{acc.join()}"
end