{post.title}
-
- {post.date}
- {post.readTime}
+
- item.trim().replace(/^["'](.*)["']$/, '$1') // Remove quotes
- .replace(/^[-\s]*/, '') // Remove leading dash and spaces
- .trim()
- );
+ if (currentKey === 'keywords') {
+ data[currentKey] = arrayItems.map(item =>
+ item.trim()
+ .replace(/^[-\s]*/, '') // Remove leading dash and spaces
+ .replace(/["']/g, '') // Remove all quotes
+ .replace(/,\s*$/, '') // Remove trailing commas
+ .trim()
+ ).filter(item => item !== ''); // Remove empty items
+ } else {
+ data[currentKey] = arrayItems.map(item =>
+ item.trim()
+ .replace(/^["'](.*)["']$/, '$1') // Remove quotes
+ .replace(/^[-\s]*/, '') // Remove leading dash and spaces
+ .replace(/,\s*$/, '') // Remove trailing commas
+ .trim()
+ ).filter(item => item !== ''); // Remove empty items
+ }
isInArray = false;
currentKey = null;
arrayItems = [];
+
+ {post.date}
+ {post.readTime}
+
+ {post.keywords?.length > 0 && (
+
+ {post.keywords
+ .filter(keyword => keyword && keyword.trim())
+ .map((keyword, index) => (
+
+ {keyword.trim()}
+
+ ))}
+
+ )}