mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-07-11 18:56:14 +09:00
Small frontmatter getter refactor, more questions
This commit is contained in:
+2
-2
@@ -168,12 +168,12 @@ function populateFrontmatter(posts, config) {
|
||||
config.frontmatterFields.forEach(field => {
|
||||
const [key, alias] = field.split(':');
|
||||
|
||||
let frontmatterGetter = frontmatter['get' + key.replace(/^./, (match) => match.toUpperCase())];
|
||||
let frontmatterGetter = frontmatter[key];
|
||||
if (!frontmatterGetter) {
|
||||
throw `Could not find a frontmatter getter named "${key}".`;
|
||||
}
|
||||
|
||||
post.frontmatter[alias || key] = frontmatterGetter(post);
|
||||
post.frontmatter[alias || key] = frontmatterGetter(post, config);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user