Only link posts that actually exists
This commit is contained in:
parent
ace63ac4cd
commit
bd2d1180f4
|
@ -43,10 +43,13 @@ class ObsidianMarkdownReader(MarkdownReader):
|
||||||
filename = group['filename'].strip()
|
filename = group['filename'].strip()
|
||||||
linkname = group['linkname'] if group['linkname'] else filename
|
linkname = group['linkname'] if group['linkname'] else filename
|
||||||
linkname = linkname.strip()
|
linkname = linkname.strip()
|
||||||
path = ARTICLES[filename]
|
path = ARTICLES.get(filename)
|
||||||
|
if path:
|
||||||
link_structure = '[{linkname}]({{filename}}/{path}/{filename}.md)'.format(
|
link_structure = '[{linkname}]({{filename}}/{path}/{filename}.md)'.format(
|
||||||
linkname=linkname, path=path, filename=filename
|
linkname=linkname, path=path, filename=filename
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
link_structure = '{linkname}'.format(linkname=linkname)
|
||||||
return link_structure
|
return link_structure
|
||||||
|
|
||||||
text = link_re.sub(replacement, text)
|
text = link_re.sub(replacement, text)
|
||||||
|
@ -98,7 +101,7 @@ def modify_metadata(article_generator, metadata):
|
||||||
"""
|
"""
|
||||||
Modify the tags so we can define the tags as we are used to in obsidian.
|
Modify the tags so we can define the tags as we are used to in obsidian.
|
||||||
"""
|
"""
|
||||||
for tag in metadata['tags']:
|
for tag in metadata.get('tags', []):
|
||||||
if '#' in tag.name:
|
if '#' in tag.name:
|
||||||
tag.name = tag.name.replace('#', '')
|
tag.name = tag.name.replace('#', '')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user