Use same gallery previews as current website
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e7fda468b7
commit
ec8a75e1e1
|
@ -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'):
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
{{ define "main" }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ .Content }}
|
||||
<section class="gallery">
|
||||
{{ range .Pages }}
|
||||
<a class="blur-on-hover" href="{{ .RelPermalink }}">
|
||||
{{ with index (.Resources.ByType "image") 0 }}
|
||||
<img alt="{{ .Title }}" src="{{ (.Fill "560x560").RelPermalink }}">
|
||||
{{ end }}
|
||||
<p>{{ .Title }}</p>
|
||||
</a>
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ partial "gallery/gallery.html" .Pages }}
|
||||
{{ end }}
|
||||
|
|
|
@ -27,14 +27,5 @@
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
<h1 id="galerie">Galerie</h1>
|
||||
<section class="gallery">
|
||||
{{ range first 4 (.Site.GetPage "/galerie").Pages }}
|
||||
<a class="blur-on-hover" href="{{ .RelPermalink }}">
|
||||
{{ with index (.Resources.ByType "image") 0 }}
|
||||
<img alt="{{ .Title }}" src="{{ (.Fill "560x560").RelPermalink }}">
|
||||
{{ end }}
|
||||
<p>{{ .Title }}</p>
|
||||
</a>
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ partial "gallery/gallery.html" (first 4 (.Site.GetPage "/galerie").Pages) }}
|
||||
{{ end }}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<section class="gallery">
|
||||
{{ range . }}
|
||||
<a class="blur-on-hover" href="{{ .RelPermalink }}">
|
||||
{{ $page := . }}
|
||||
{{ with .Params.preview }}
|
||||
{{ $image := $page.Resources.GetMatch . }}
|
||||
<img alt="{{ $image.Title }}" src="{{ ($image.Fill "560x560").RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ with index (.Resources.ByType "image") 0 }}
|
||||
<img alt="{{ .Title }}" src="{{ (.Fill "560x560").RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<p>{{ .Title }}</p>
|
||||
</a>
|
||||
{{ end }}
|
||||
</section>
|
Loading…
Reference in New Issue