@@ -138,20 +138,24 @@ export function getGrantYear(slug) {
138138 return dir;
139139}
140140
141−export function getGrantByShortcode(shortcode) {
141+export function getGrantsByShortcode(shortcode) {
142142 const basePath = join(process.cwd(), 'content/grants')
143143 const years = fs.readdirSync(basePath, { 'withFileTypes': true }).filter((f) => f.isDirectory());
144− let found = null
145− const dir = years.find((year) => {
144+ let found = [];
145+ // Get matching years by any matching grant.
146+ years.forEach((year) => {
146147 const yearDir = fs.readdirSync(join(basePath, year.name), { 'withFileTypes': true });
147− const foundFile = yearDir.find((file) => {
148+ return yearDir.forEach((file) => {
148149 const { data } = matter(fs.readFileSync(join(basePath, year.name, file.name)), options);
149− return data?.extra?.deliverable === shortcode.join("/")
150+ if (data?.extra?.deliverable === shortcode.join("/")) {
151+ found.push({
152+ ...data, ...{ slug: file.name.replace('.md', '') }
153+ }
154+ )
155+ }
150156 })
151− found = foundFile;
152− return foundFile
153157 });
154− return found?.name?.replace(".md", "");
158+ return found
155159}
156160
157161// Groups arrays into an array of arrays with 2 members