Skip to content

Instantly share code, notes, and snippets.

@Arty2
Last active December 27, 2020 20:56
Show Gist options
  • Save Arty2/b102e4049ff4cf81d17125e420fd82f2 to your computer and use it in GitHub Desktop.
Save Arty2/b102e4049ff4cf81d17125e420fd82f2 to your computer and use it in GitHub Desktop.
Loop through every .jpg file in the same directory and make a Hugo page bundle out of each.
@echo OFF
rem loop through all JPG files
for %%f IN (*.jpg) DO (
rem make a new directory with the same filename
mkdir %%~nf
rem move file the new directory
move %%f %%~nf/%%f
rem go inside the new directory
cd %%~nf
rem generate YAML frontmatter and save as index.en.md
(
echo ---
echo directURL: %%f
echo cover: %%f
echo render: never
echo list: local
echo publishResources: false
rem date is not returned consistently across locales
rem echo date: %%~tf
echo ---
) > index.en.md
rem create file in another language with the same content
copy index.en.md index.el.md
rem return back to the working directory
cd ../
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment