import * as path from 'node:path';
import * as fs from 'node:fs';

const conf = {
	tags: "portfolio",
	layout: "portfolio.njk",
	eleventyComputed: {
		images(data) {
			const dir = path.dirname(data.page.inputPath);

			const images = fs.readdirSync(dir)
				.filter(file => ['.png', '.jpg', '.jpeg', '.JPG'].includes(path.extname(file)))
				.sort()
				.map(image => `${data.page.url}${image}`);

			return images;
		},
		data(data) { return data; },
	}
};

export default conf;