diff --git a/bin/download_galleries.py b/bin/download_galleries.py index 3789dfe..16b3178 100755 --- a/bin/download_galleries.py +++ b/bin/download_galleries.py @@ -85,18 +85,20 @@ def download_gallery(path): md = MarkdownConverter() content = '\n\n'.join(md.convert_soup(p) for p in soup.select('.field-type-text-with-summary > .field-items > .field-item > p')) + picture = soup.find(class_='picture') + preview = search('https?://kontakt-bamberg.de[-./\w]+', picture.get('style')) + index = target / 'index.md' index.write_text(f'''--- slug: "{slug}" title: {dump(title, Dumper=CDumper).rstrip()} date: {date} +preview: "{unquote(preview[0].rsplit('/', 1)[-1])}" --- {content} ''') - picture = soup.find(class_='picture') - preview = search('https?://kontakt-bamberg.de[-./\w]+', picture.get('style')) download_image(preview[0], target) for a in soup.select('.field-name-field-pictures > .field-items > .field-item > a'): diff --git a/layouts/galerie/section.html b/layouts/galerie/section.html index 3ec62f3..32292d3 100644 --- a/layouts/galerie/section.html +++ b/layouts/galerie/section.html @@ -1,14 +1,5 @@ {{ define "main" }}

{{ .Title }}

{{ .Content }} - +{{ partial "gallery/gallery.html" .Pages }} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index 99c1d1b..fbdf3c2 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -27,14 +27,5 @@ {{ end }} {{ end }}

Galerie

- +{{ partial "gallery/gallery.html" (first 4 (.Site.GetPage "/galerie").Pages) }} {{ end }} diff --git a/layouts/partials/gallery/gallery.html b/layouts/partials/gallery/gallery.html new file mode 100644 index 0000000..77beff2 --- /dev/null +++ b/layouts/partials/gallery/gallery.html @@ -0,0 +1,16 @@ +