diff --git a/config.yaml b/config.yaml index 2ed6b33..931fdc6 100644 --- a/config.yaml +++ b/config.yaml @@ -8,9 +8,9 @@ site_defaults: pages: ./templates/pages sites: main: - build_cache: ./build + build_cache: ./site assets: - - ./assets + - /assets articles: - ./pages/*.md resume: @@ -24,7 +24,7 @@ sites: build_cache: ./build/dogma-jimfinium web_root: ./dist/dogma-jimfinium assets: - - '{build_cache}/assets' + - assets articles: - - '{build_cache}/*.md' + - '*.md' \ No newline at end of file diff --git a/main.py b/main.py index 3fca3d1..106fecb 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,6 @@ import os +import glob +import shutil import subprocess import markdown import yaml @@ -30,7 +32,7 @@ class ArticleMetadata(pydantic.BaseModel): title: str author: Optional[str] = config.get('author') date: date - lastmod: Optional[date] + lastmod: Optional[date] = None published: bool tags: list thumbnail: Optional[str] = None @@ -73,20 +75,13 @@ def format_html_template(template: str, **kwargs) -> str: return html -REPOS = [ - 'ssh://gitea/jim/resume.git', - 'ssh://gitea/jim/dogma-jimfinium.git' -] run = lambda cmd: subprocess.run(cmd.split(' '), stdout = subprocess.PIPE, stderr = subprocess.PIPE) -def update_git_repos(repos: list) -> None: - '''Pulls updates to repos in the build directory, or clones them if they don't exist.''' - for repo in repos: - local_path = 'build/'+repo.split('/')[-1].strip('.git') - print(local_path) - if os.path.exists(f'{local_path}/.git'): - run(f'git -C {local_path} pull origin') - else: - run(f'git clone {repo} {local_path}') +def pull_git_repo(repo: str, build_cache: str) -> None: + '''Pulls/clones a repo into the build cache directory.''' + if os.path.exists(f'{build_cache}/.git'): + run(f'git -C {build_cache} pull origin') + else: + run(f'git clone {repo} {build_cache}') def load_partials() -> dict: @@ -147,7 +142,7 @@ def build_blog_archive( # Add each article as a list item to an unordered list. archive_html_content = '