Meta: Port several things common to various Python scripts to a new website module

This commit is contained in:
Eryn Wells 2024-11-17 14:49:33 -08:00
parent a30903c8cf
commit 9ce6362402
6 changed files with 70 additions and 34 deletions

19
scripts/website/paths.py Normal file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# Eryn Wells <eryn@erynwells.me>
import os.path as osp
def content_path() -> str:
'''Return the path to the content directory.'''
path = osp.abspath(osp.join(osp.dirname(__file__), '..', '..', 'content'))
assert osp.isdir(path)
return path
def blog_path() -> str:
return osp.join(content_path(), 'blog')
def photos_path() -> str:
return osp.join(content_path(), 'photos')