fix linting
This commit is contained in:
parent
e7b1af8a06
commit
35fdf3286f
|
@ -11,7 +11,7 @@ import yaml from 'js-yaml';
|
|||
*/
|
||||
export const generatePostFrontMatter = (
|
||||
fileContents: string,
|
||||
includeContent: boolean = false
|
||||
includeContent: false
|
||||
): {
|
||||
[ key: string ]: unknown;
|
||||
} => {
|
||||
|
@ -34,8 +34,10 @@ export const generatePostFrontMatter = (
|
|||
},
|
||||
} );
|
||||
const content = frontMatter.content.split( '\n' );
|
||||
const headings = content.filter( ( line ) => line.substring( 0, 2 ) === '# ' );
|
||||
const title = headings[0]?.substring( 2 ).trim();
|
||||
const headings = content.filter(
|
||||
( line ) => line.substring( 0, 2 ) === '# '
|
||||
);
|
||||
const title = headings[ 0 ]?.substring( 2 ).trim();
|
||||
|
||||
frontMatter.data.post_title = frontMatter.data.post_title ?? title;
|
||||
if ( includeContent ) {
|
||||
|
|
|
@ -54,7 +54,7 @@ async function processDirectory(
|
|||
const categoryFolder = path.basename( subDirectory );
|
||||
const categoryTitle = categoryFolder
|
||||
.split( '-' )
|
||||
.map( ( slugPart ) => slugPart.charAt( 0 ).toUpperCase() + slugPart.slice( 1 ) )
|
||||
.map( ( slugPart) => slugPart.charAt( 0 ).toUpperCase() + slugPart.slice( 1 ) )
|
||||
.join( ' ' );
|
||||
category.category_slug = category.category_slug ?? categoryFolder;
|
||||
category.category_title = category.category_title ?? categoryTitle;
|
||||
|
|
Loading…
Reference in New Issue