diff --git a/utils/content.ts b/utils/content.ts index 67cb7fb..5ee7007 100644 --- a/utils/content.ts +++ b/utils/content.ts @@ -114,8 +114,11 @@ export const getAllContentIds = (contentType: IContentType) => { * @param {string} contentType Type of content */ -export const getContentData = async (id: string, contentType: IContentType) => { - let contentTypeDirectory; +export const getContentData = async ( + id: string, + contentType: IContentType, +): Promise => { + let contentTypeDirectory: string; let filenames; switch (contentType.toLowerCase()) { case 'articles': @@ -140,7 +143,6 @@ export const getContentData = async (id: string, contentType: IContentType) => { // loop through all the content types and compare the slug to get the filename const match = filenames.filter((filename) => { const filePath = path.join(contentTypeDirectory, filename); - const fileContent = fs.readFileSync(filePath, 'utf-8'); const matterResult = matter(fileContent); const { slug } = matterResult.data;