Minimum viable blog My requirements Should use a domain I already own Should follow modern web standards and have decent SEO It should be very easy to add new content All pages should be statically built This is what I did: Write a small template.html pip install markdown2 Tired, so ask O1 for a render.py script Write some posts Just render, host it, and THAT'S IT! Jekyll? Ghost? Wordpress? All the same, into the bin! <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Carl Öst Wilkens' Blog</title> <style> :root { color-scheme: light dark; } html { font-family: system-ui, sans-serif; max-width: 70ch; padding: 3em 1em; margin: auto; line-height: 1.5; font-size: 1.25em; } </style> </head> <body> <a href="/" id="head-link">Carl Öst Wilkens' Blog</a> {{ content }} </body> </html> import os import markdown2 def main(): # Define the directory containing the Markdown files posts_dir = './posts' output_dir = './blog' # Read template.html with open("template.html", 'r', encoding='utf-8') as file: template = file.read() # Create output directory if it doesn't exist os.makedirs(output_dir, exist_ok=True) # Iterate over all dirs in the posts directory for post_directory in os.listdir(posts_dir): post_code = post_directory # Construct full file path file_path = os.path.join(posts_dir, post_directory, 'eng.md') # Read the Markdown file with open(file_path, 'r', encoding='utf-8') as file: md_content = file.read() # Find first line which contains "# " title = md_content.split("# ", 1).pop(1).split("\n").pop(0) # Convert Markdown to HTML html_content = markdown2.markdown(md_content, extras=['fenced-code-blocks', "header-ids"]) html_content = html_content.replace('<img src="', f'<img src="/posts/{post_code}/') html_content = template.replace('{{ content }}', html_content) html_content = html_content.replace('Minimum viable blog', title) # Construct HTML file path html_filename = post_code + ...
First seen: 2025-05-03 10:44
Last seen: 2025-05-04 10:48