Skip to content

Commit

Permalink
Split skills by main and other skills, if configured
Browse files Browse the repository at this point in the history
  • Loading branch information
awinterstein committed Dec 2, 2024
1 parent 39d174c commit 2f9a9b1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
22 changes: 18 additions & 4 deletions templates/macros.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<!-- Shows a list of all given terms of a taxonomy. An icon is shown in front of each term. This icon needs to be given as an SVG path. -->
{% macro terms_list(terms, icon_definition) %}
<div class="flex flex-wrap sm:flex-row flex-col sm:gap-x-7 gap-y-5 mt-6">
{% macro terms_list(terms, icon_definition, maximum_amount='', minimum_amount='') %}
<div class="flex flex-wrap justify-center sm:flex-row flex-col sm:gap-x-7 gap-y-5 mt-6 mb-6">
{% for term in terms %}
{# Show term only if its item count is between minimum and maximum amount (if those parameters are given) #}
{% if (not minimum_amount or term.pages | length >= minimum_amount) and (not maximum_amount or term.pages | length <= maximum_amount) %}
<a href="{{ term.permalink | safe }}" class="flex items-center space-x-2">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="{{ icon_definition }}">
</path>
</svg>
<span class="text-bold">{{term.name}} <sup>{{ term.pages | length }}</sup></span>
</a>
{% endif %}
{% endfor %}
</div>
{% endmacro %}
Expand All @@ -21,12 +24,23 @@
{% endmacro %}

<!-- Shows a list of all given terms of a taxonomy with the skills terms icon in front of each term. -->
{% macro terms_list_skills(terms) %}
{{ macros::terms_list(terms=terms, icon_definition="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7
{% macro terms_list_skills(terms, maximum_amount='', minimum_amount='') %}
{{ macros::terms_list(terms=terms, maximum_amount=maximum_amount, minimum_amount=minimum_amount, icon_definition="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7
7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0
014-4z") }}
{% endmacro %}


<!-- Shows a list of all given terms with at least 'threshold' items of a taxonomy with the skills terms icon in front of each term. -->
{% macro terms_list_skills_main(terms, threshold) %}
{{ macros::terms_list_skills(terms=terms, minimum_amount=threshold) }}
{% endmacro %}

<!-- Shows a list of all given terms with less than 'threshold' items of a taxonomy with the skills terms icon in front of each term. -->
{% macro terms_list_skills_other(terms, threshold) %}
{{ macros::terms_list_skills(terms=terms, maximum_amount=threshold-1) }}
{% endmacro %}

<!-- Shows the given skills that are part of a project. -->
{% macro project_list_skills(skills) %}
<div class="flex sm:flex-row flex-col flex-wrap sm:gap-x-7">
Expand Down
11 changes: 11 additions & 0 deletions templates/skills/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@
{% extends "layout.html" %}

{% block content %}

{% set page = get_page(path="skills.md", lang=lang) %}
<div class="flex items-center flex-col mt-10 px-4">
<h1 class="text-2xl text-bold">{{ page.title }}</h1>

<div class="text-bold mt-4">{{ page.content | safe }}</div>

{% if config.extra.skills.main_skills_threshold %}
{% if config.extra.skills.main_skills_heading %}<h2> {{ config.extra.skills.main_skills_heading }}</h2>{% endif %}
{{ macros::terms_list_skills_main(terms=terms, threshold=config.extra.skills.main_skills_threshold) }}

{% if config.extra.skills.other_skills_heading %}<h2>{{ config.extra.skills.other_skills_heading }}</h2>{% endif %}
{{ macros::terms_list_skills_other(terms=terms, threshold=config.extra.skills.main_skills_threshold) }}
{% else %}
{{ macros::terms_list_skills(terms=terms) }}
{% endif %}

</div>

{% endblock content %}
6 changes: 6 additions & 0 deletions theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,9 @@ apple_touch_icon = "/icons/apple-touch-icon.png"
android_chrome_512 = "/icons/android-chrome-512x512.png"
android_chrome_192 = "/icons/android-chrome-192x192.png"
manifest = "/icons/site.webmanifest"

# Configuration parameters for the skills taxonomy overview page
[extra.skills]
#main_skills_threshold = 5 # Set this variable to show all skills with at least n projects as main skills
#main_skills_heading = "Main Skills" # The heading for the main skills list (only relevant, if main_skills_threshold is set)
#other_skills_heading = "Additional Skills" # The heading for the list of the other skills (only relevant, if main_skills_threshold is set)

0 comments on commit 2f9a9b1

Please sign in to comment.