linkedin-posts-scraper/construct_hugo_content_links.py

16 lines
458 B
Python
Raw Permalink Normal View History

2023-02-19 11:10:12 +00:00
# scan the true content folder and recreate all the symbolic links
from os.path import basename
from pathlib import Path
SITE_BASE = "./janco_website"
MD_ORGANIZED_CONTENT_BASE = "./janco_website/true_content/posts"
MD_FLAT_CONTENT_BASE = "./janco_website/content/posts"
for path in Path(MD_ORGANIZED_CONTENT_BASE).rglob('*.md'):
bn = basename(path)
Path(MD_FLAT_CONTENT_BASE + '/' + bn).symlink_to('../../' + str(path.relative_to(SITE_BASE)))