lvl0-website/themes/linkita/templates/shortcodes/projects.html

45 lines
1.8 KiB
HTML
Raw Normal View History

2025-07-10 20:07:36 +02:00
{% import "macros/url.html" as m_url %}
{%- if url is defined %}
{%- set projects = load_data(url=url, format=format) %}
{%- elif path is starting_with("/") %}
{%- set projects = load_data(path=path, format=format, required=true) %}
{%- elif page.colocated_path | default(value=section.colocated_path) %}
{%- set path_colocated = page.colocated_path | default(value=section.colocated_path) %}
{%- set projects = load_data(path=path_colocated~path, format=format, required=true) %}
{%- else %}
{%- for asset in page.assets | default(value=section.assets) %}
{%- if asset is ending_with(path) %}
{%- set_global projects = load_data(path=asset, format=format, required=true) %}
{%- break %}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- for project in projects.project %}
{%- set name = project.languages[lang].name | default(value=project.name) %}
{%- set desc = project.languages[lang].desc | default(value=project.desc) %}
{%- set tags = project.languages[lang].tags | default(value=project.tags) %}
{%- set links = project.links %}
<div class="not-prose text-base leading-7 block-bg my-4 flex w-full flex-col rounded-lg px-5 py-1.5">
<h2 class="my-2 text-xl font-bold text-black dark:text-white">{{ name }}</h2>
<p>{{ desc | markdown(inline=true) | safe }}</p>
<div class="my-2 flex flex-wrap items-center justify-between">
<div class="flex flex-wrap gap-x-2 text-sm opacity-80">
{%- for tag in tags %}
<span>#{{ tag }}</span>
{%- endfor %}
</div>
<div class="flex flex-wrap gap-x-2">
{%- for link in links %}
<a
class="underline"
href="{{ m_url::get(url=link.url) }}"
{%- if link.newtab | default(value=true) %}
target="_blank"{% endif %}
>{{ link.name }}</a>
{%- endfor %}
</div>
</div>
</div>
{%- endfor %}