mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-11-22 07:19:53 +00:00
Fix markdown with no title not displaying in search
This commit is contained in:
parent
0c5f367ceb
commit
014d72f39c
@ -164,7 +164,7 @@ def main(args):
|
|||||||
for tag in fm.get('tags'):
|
for tag in fm.get('tags'):
|
||||||
t = {
|
t = {
|
||||||
'path': str(pathlib.Path(output_filename).relative_to(args.output_dir)),
|
'path': str(pathlib.Path(output_filename).relative_to(args.output_dir)),
|
||||||
'title': fm.get('title')
|
'title': fm.get('title') or pathlib.Path(filename).name
|
||||||
}
|
}
|
||||||
if tag in tag_dict.keys():
|
if tag in tag_dict.keys():
|
||||||
tag_dict[tag].append(t)
|
tag_dict[tag].append(t)
|
||||||
@ -181,7 +181,7 @@ def main(args):
|
|||||||
|
|
||||||
all_entries.append({
|
all_entries.append({
|
||||||
'path': str(pathlib.Path(*pathlib.Path(output_filename).parts[1:])),
|
'path': str(pathlib.Path(*pathlib.Path(output_filename).parts[1:])),
|
||||||
'title': fm.get('title'),
|
'title': fm.get('title') or pathlib.Path(filename).name,
|
||||||
'tags': fm.get('tags'),
|
'tags': fm.get('tags'),
|
||||||
'headers': header_lines
|
'headers': header_lines
|
||||||
})
|
})
|
||||||
@ -284,9 +284,9 @@ def main(args):
|
|||||||
soup = bs(fp.read(), 'html.parser')
|
soup = bs(fp.read(), 'html.parser')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
title = soup.find('title').get_text()
|
title = soup.find('title').get_text() or pathlib.Path(path).name
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
title = path
|
title = pathlib.Path(path).stem
|
||||||
elif fullpath.is_dir():
|
elif fullpath.is_dir():
|
||||||
title = path
|
title = path
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user