Fancybox gallery

This commit is contained in:
2024-01-12 16:31:33 +01:00
parent baacec9f2a
commit 6b63e34d64
125 changed files with 78 additions and 0 deletions

View File

@ -7,6 +7,7 @@
<title>{% block title %}{{ config.title }}{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{{ get_url(path="/style.css") }}">
<link rel="stylesheet" type="text/css" href="{{ get_url(path="/icons/remixicon-4.0.0.css") }}">
{% block style %}{% endblock %}
</head>
<body>
<nav>

View File

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block content %}
{% for gallery in section.pages %}
<a href="{{ gallery.permalink }}">{{ gallery.title }}</a>
{% endfor %}
{% endblock %}

26
templates/gallery.html Normal file
View File

@ -0,0 +1,26 @@
{% extends "base.html" %}
{% block style %}
<link rel="stylesheet" href="{{ get_url(path="fancybox/fancybox.css") }}">
{% endblock %}
{% block content %}
<section class="gallery wrap narrow centering">
<h1>{{ page.title }}</h1>
<span class="subtitle">
{% if page.extra.beh %}
{{ page.extra.beh }}.&nbsp;běh&nbsp;
{%- endif -%}
{{ page.date | date(format="%Y") }}
</span>
{{ page.content | safe }}
</section>
<section class="gallery wrap grid grid-4 grid-mobile-3">
{{ macros::gallery(page=page) }}
</section>
{% endblock %}
{% block script %}
<script src="{{ get_url(path="fancybox/fancybox.js") }}"></script>
<script>Fancybox.bind("[data-fancybox]", {});</script>
{% endblock %}

View File

@ -38,3 +38,12 @@
{% endfor %}
{% endmacro %}
{% macro gallery(page) %}
{% for asset in page.assets %}
{% if asset is matching("[.](jpg|png)$") %}
{% set image = resize_image(path=asset, width=300, height=200, op="fill") %}
<a data-fancybox="{{ page.title }}" href="{{ get_url(path=asset) }}"><img src="{{ image.url }}" alt="{{ asset }}"></a>
{% endif %}
{% endfor %}
{% endmacro %}