Attempt to use a databag for featured projects

This commit is contained in:
HackerNCoder 2022-10-27 19:50:16 +02:00
parent 726fe7e133
commit 27bd6e7d79
4 changed files with 14 additions and 9 deletions

View file

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

8
databags/featured.ini Normal file
View file

@ -0,0 +1,8 @@
[lucahboad]
title = Lucah Born Of A Dream
path = /projects/lucahboad/
sort_key = 0
[butterflysoup]
title = Butterfly Soup
path = /projects/butterflysoup/
sort_key = 1

View file

@ -16,6 +16,3 @@ translate = True
[fields.join_title]
type = string
translate = True
[children]
replaced_with = site.query('/projects')

View file

@ -5,16 +5,16 @@
<!-- Projects-->
<section class="projects-section bg-light" id="projects">
<div class="container px-4 px-lg-5">
{% for project in this.children %}
{% set image = project.attachments.images.first() %}
{% for id, item in bag('featured').items() %}
{% set image = url(item.path+'main.jpg') %}
<div class="row gx-0 mb-5 mb-md-0 justify-content-center">
<div class="col-lg-6"><img class="img-fluid" src="{{ image|url }}" alt="project image" /></div>
<div class="col-lg-6 {% if project.sort_key % 2 == 0 or project.sort_key == 0 %} order-lg-first {% endif %} ">
<div class="col-lg-6"><img class="img-fluid" src="{{ image }}" alt="project image" /></div>
<div class="col-lg-6 {% if item.sort_key % 2 == 0 or item.sort_key == 0 %} order-lg-first {% endif %} ">
<div class="bg-black text-center h-100 project">
<div class="d-flex h-100">
<div class="my-4 my-lg-auto w-100 text-center">
<h2 class="text-white mb-5">{{ project.title }}</h2>
<a href="{{ project|url }}" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i> {{ _("Details") }}</a>
<h2 class="text-white mb-5">{{ item.title }}</h2>
<a href="{{ path|url }}" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i> {{ _("Details") }}</a>
</div>
</div>
</div>