commit aa9e641d4cb1d3edd37ca205a9e57591b0fc5c7f
parent e482c112dbf0399fe192eda249d09e55291cddfb
Author: Ed van Bruggen <edvb@uw.edu>
Date: Fri, 2 Jul 2021 01:21:59 -0700
Generate photos page with mk-contect
Diffstat:
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/content/photos/_index.md b/content/photos/_index.md
@@ -1,11 +0,0 @@
----
-title: photos
----
-
-<!-- TODO move photos to layout and make for loop -->
-{{< photos limit="5" dir="seattle">}}
-{{< photos limit="5" dir="quarantine">}}
-{{< photos limit="5" dir="galapagos">}}
-{{< photos limit="5" dir="britain">}}
-{{< photos limit="5" dir="france">}}
-{{< photos limit="5" dir="peru">}}
diff --git a/mk-content.py b/mk-content.py
@@ -54,12 +54,18 @@ with open('data/projects.yaml') as d:
break
shutil.copyfileobj(response, f)
+# TODO replace with parital in layout page
+# https://gohugo.io/templates/lookup-order/
with open('data/photos.yaml') as d:
data = yaml.load(d, Loader=yaml.FullLoader)
- for code in data['photos']:
- title = code['name']
+ with open(f'content/photos/_index.md', 'w') as f:
+ f.write(f'---\ntitle: photos\n---\n')
+ for album in data['photos']:
+ f.write(f'{{{{< photos limit="5" dir="{album["name"]}">}}}}\n')
+ for album in data['photos']:
+ title = album['name']
name = title.replace(' ', '-')
with open(f'content/photos/{name}.md', 'w') as f:
f.write(f'---\ntitle: {title}\n---\n')
- f.write(f'{{{{< photos limit="999" dir="{title}">}}}} ')
+ f.write(f'{{{{< photos limit="999" dir="{title}">}}}}\n')
# print(f'done {name}.md')