website: fix missing target_dir error

This commit is contained in:
Starbeamrainbowlabs 2024-10-16 20:18:51 +01:00
parent 565dc81994
commit bfc22ae6dd
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -37,8 +37,9 @@ async function shortcode_image(src, alt) {
} }
async function shortcode_image_url(src) { async function shortcode_image_url(src) {
const target_dir = `./_site/img`;
const src_parsed = path.parse(src); const src_parsed = path.parse(src);
const target = path.join(`./_site/img`, src_parsed.base); const target = path.join(target_dir, src_parsed.base);
if(!fs.existsSync(path.dirname(target))) if(!fs.existsSync(path.dirname(target)))
await fs.promises.mkdir(target_dir, { recursive: true }); await fs.promises.mkdir(target_dir, { recursive: true });
await fs.promises.copyFile(src, target); await fs.promises.copyFile(src, target);