Skip to content

Commit

Permalink
fix: hotfix for title file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Aug 6, 2022
1 parent f2635e1 commit b86cc34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugin/src/filePathConvertor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function createObsidianPath(
const folderDefault = settings.folderDefaultName;
let fileName = folderNoteIndex(file, vault, settings);
if (fileName === file.name && settings.useFrontmatterTitle && frontmatter['title']) {
fileName = frontmatter['title'];
fileName = frontmatter['title'] + '.md';
}
const rootFolder = folderDefault.length > 0 ? folderDefault + "/" : ''
const path = rootFolder + file.path.replace(file.name, fileName);
Expand Down Expand Up @@ -130,7 +130,7 @@ function createFrontmatterPath(
const parentCatFolder = !category.endsWith('/') ? category.split('/').at(-1): category.split('/').at(-2);
let fileName = settings.folderNote && parentCatFolder === file.name.replace('.md', '') ? 'index.md' : file.name
if (fileName != "index.md" && frontmatter['title'] && frontmatter['title'] !== file.name) {
fileName = frontmatter['title'];
fileName = frontmatter['title'] + '.md';
}
path = folderRoot + frontmatter[settings.yamlFolderKey] + "/" + fileName;
}
Expand All @@ -145,7 +145,7 @@ function getReceiptFolder(
if (file.extension === 'md') {
let fileName = file.name
if (settings.useFrontmatterTitle && metadataCache.getCache(file.path).frontmatter['title']) {
fileName = metadataCache.getCache(file.path).frontmatter['title']
fileName = metadataCache.getCache(file.path).frontmatter['title'] + '.md'
}
let path = settings.folderDefaultName.length > 0 ? settings.folderDefaultName + "/" + fileName : fileName;

Expand Down

0 comments on commit b86cc34

Please sign in to comment.