diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2022-12-14 22:02:30 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2022-12-14 22:02:30 -0600 |
commit | 8461a3b8d48bc772ef449e37e5c98ffc254930fe (patch) | |
tree | 16ac0e759e6b361cd917602a25dad0bd128a8ea4 | |
parent | abc0de079b895af1b705894eb2b63596e3e37274 (diff) |
add new files for pyssg.xyz, add multiple document support
-rw-r--r-- | pyssg.xyz/config.yaml | 31 | ||||
-rw-r--r-- | pyssg.xyz/plt/blog/index.html (renamed from pyssg.xyz/plt/index.html) | 0 | ||||
-rw-r--r-- | pyssg.xyz/plt/blog/page.html (renamed from pyssg.xyz/plt/page.html) | 0 | ||||
-rw-r--r-- | pyssg.xyz/plt/blog/tag.html (renamed from pyssg.xyz/plt/tag.html) | 0 | ||||
-rw-r--r-- | pyssg.xyz/src/blog/first.md | 10 | ||||
-rw-r--r-- | src/pyssg/pyssg.py | 67 |
6 files changed, 76 insertions, 32 deletions
diff --git a/pyssg.xyz/config.yaml b/pyssg.xyz/config.yaml index cd5d4d7..7fa948e 100644 --- a/pyssg.xyz/config.yaml +++ b/pyssg.xyz/config.yaml @@ -29,4 +29,35 @@ dirs: rss: True sitemap: True exclude_dirs: [] +... +--- +define: &root_path "$HOME/pyssg/pyssg.xyz/" + +title: "pyssg blog" +author: "David Luévano Alvarado" +author_email: "david@luevano.xyz" +description: "PySSG blog, the python static site generator official blog." +lang: "en" +path: + src: !join [*root_path, "src/blog"] + dst: !join [*root_path, "live/blog"] + plt: !join [*root_path, "plt"] + db: !join [*root_path, "db_blog.psv"] +url: + main: "https://blog.pyssg.xyz" + static: "https://static.pyssg.xyz" + default_image: "images/default.png" +fmt: + date: "%a, %b %d, %Y @ %H:%M %Z" + list_date: "%b %d" + list_sep_date: "%B %Y" +dirs: + /: + cfg: + plt: "blog/page.html" + tags: "blog/tag.html" + index: "blog/index.html" + rss: True + sitemap: True + exclude_dirs: [] ...
\ No newline at end of file diff --git a/pyssg.xyz/plt/index.html b/pyssg.xyz/plt/blog/index.html index 96d66ef..96d66ef 100644 --- a/pyssg.xyz/plt/index.html +++ b/pyssg.xyz/plt/blog/index.html diff --git a/pyssg.xyz/plt/page.html b/pyssg.xyz/plt/blog/page.html index d7f5e43..d7f5e43 100644 --- a/pyssg.xyz/plt/page.html +++ b/pyssg.xyz/plt/blog/page.html diff --git a/pyssg.xyz/plt/tag.html b/pyssg.xyz/plt/blog/tag.html index 59cbdf1..59cbdf1 100644 --- a/pyssg.xyz/plt/tag.html +++ b/pyssg.xyz/plt/blog/tag.html diff --git a/pyssg.xyz/src/blog/first.md b/pyssg.xyz/src/blog/first.md new file mode 100644 index 0000000..567ea3e --- /dev/null +++ b/pyssg.xyz/src/blog/first.md @@ -0,0 +1,10 @@ +title: First blog post for testing purposes +author: David Luévano +lang: en +summary: This is just a post used for testing. +tags: test + english + short + update + +Even though I have this "blog" subdomain and page setup, doesn't mean I'll be blogging for pyssg, this is just to serve as an example for the types of sites that pyssg can be used for.
\ No newline at end of file diff --git a/src/pyssg/pyssg.py b/src/pyssg/pyssg.py index d158caa..e9cf28c 100644 --- a/src/pyssg/pyssg.py +++ b/src/pyssg/pyssg.py @@ -72,46 +72,49 @@ def main() -> None: log.debug('reading config files') config_all: list[dict] = get_parsed_config(config_path) static_config: dict = get_static_config() - - # easier to add static into config than changing existing code - config: dict = config_all[0] - config['fmt']['rss_date'] = static_config['fmt']['rss_date'] - config['fmt']['sitemap_date'] = static_config['fmt']['sitemap_date'] - config['info'] = dict() - config['info']['version'] = static_config['info']['version'] - config['info']['debug'] = str(args['debug']) + log.debug('applying static_config for each config document') + for config in config_all: + config['fmt']['rss_date'] = static_config['fmt']['rss_date'] + config['fmt']['sitemap_date'] = static_config['fmt']['sitemap_date'] + config['info'] = dict() + config['info']['version'] = static_config['info']['version'] + config['info']['debug'] = str(args['debug']) if args['init']: log.info('initializing the directory structure and copying over templates') - create_dir(config['path']['src']) - # dst gets created on builder - # create_dir(config['path']['dst']) - create_dir(config['path']['plt']) - files: list[str] = ['index.html', - 'page.html', - 'tag.html', - 'rss.xml', - 'sitemap.xml'] - log.debug('list of files to copy over: (%s)', ', '.join(files)) - for f in files: - plt_file: str = os.path.join(config['path']['plt'], f) - with rpath('pyssg.plt', f) as p: - copy_file(str(p), plt_file) + for config in config_all: + log.info('initializing directories for "%s"', config['title']) + create_dir(config['path']['src']) + # dst gets created on builder + # create_dir(config['path']['dst']) + create_dir(config['path']['plt']) + files: list[str] = ['index.html', + 'page.html', + 'tag.html', + 'rss.xml', + 'sitemap.xml'] + log.debug('list of files to copy over: (%s)', ', '.join(files)) + for f in files: + plt_file: str = os.path.join(config['path']['plt'], f) + with rpath('pyssg.plt', f) as p: + copy_file(str(p), plt_file) log.info('finished initialization') sys.exit(0) if args['build']: log.info('building the html files') - db: Database = Database(config['path']['db']) - db.read() - - log.debug('building all dir_paths found in config') - for dir_path in config['dirs'].keys(): - log.debug('building for "%s"', dir_path) - builder: Builder = Builder(config, db, dir_path) - builder.build() - - db.write() + for config in config_all: + log.info('building html for "%s"', config['title']) + db: Database = Database(config['path']['db']) + db.read() + + log.debug('building all dir_paths found in config') + for dir_path in config['dirs'].keys(): + log.debug('building for "%s"', dir_path) + builder: Builder = Builder(config, db, dir_path) + builder.build() + + db.write() log.info('finished building the html files') sys.exit(0) |