mp3md
DIR = %(content/music/)
MP3DIR = %(audio)
$md = <<~'MD'
+++
title = '@@title'
date = 2024-02-28T18:04:10+01:00
draft = false
+++
(two curly braces)< audio src="@@title.mp3" >(closing braces)
MD
def create_md(title)
path = '%s%s.md' % [DIR, title]
File.write(path, $md.gsub(/@@title/, title)) unless File.exist? path
end
Dir.glob(format('%s%s/*.mp3', DIR, MP3DIR)).each do |file|
create_md(File.basename(file.delete_suffix('.mp3')))
end
I use this to create an md-file for every mp3-file found in subfolder. (closing braces) is replaced with ‘}}’ and (two curly braces) is replaced with ‘{{’
inserting shortcode from layouts (a simple audio tag)
- Todo
- use create-time for mp3 as date in heading.