2023-12-15 10:30:18 -05:00

32 lines
778 B
Python

from flask import url_for
from markdown import markdown
import frontmatter
import os
markdown_dir = '{}/markdown'.format(
os.path.dirname(os.path.abspath(__file__)))
title = 'About me'
def get_title():
return title
def __get_content_dict():
sections = dict()
for file in os.listdir(markdown_dir):
images = list()
matter = frontmatter.load('{}/{}'.format(markdown_dir, file))
for img in matter.metadata['images']:
images.append('{}/{}'.format(
matter.metadata['image-dir'], img))
sections[file.removesuffix('.md')] = {'images':
images, 'content': markdown(matter.content)}
return sections
content = __get_content_dict()
def get_content():
return content.values()