fix: clean up loop implementations
This commit is contained in:
parent
5f6a1a8d33
commit
f8b18a91bc
5 changed files with 13 additions and 36 deletions
|
@ -1,12 +1,6 @@
|
||||||
{% set allColors = colors | entries %}
|
|
||||||
|
|
||||||
html {
|
html {
|
||||||
{% for color in allColors %}
|
{% for colorName, colorValues in colors %}
|
||||||
{% set colorName = color | first %}
|
{% for value, hex in colorValues %}
|
||||||
{% set colorRanges = color | last | entries %}
|
|
||||||
{% for colorValue in colorRanges %}
|
|
||||||
{% set value = colorValue | first %}
|
|
||||||
{% set hex = colorValue | last %}
|
|
||||||
--color-{{ colorName }}-{{ value }}: {{ hex }};
|
--color-{{ colorName }}-{{ value }}: {{ hex }};
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
{% set allFonts = fonts | entries %}
|
{% set allFonts = fonts | entries %}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
{% for font in allFonts %}
|
{% for fontType, fontConfig in fonts %}
|
||||||
{% set fontType = font | first %}
|
|
||||||
{% set fontConfig = font | last %}
|
|
||||||
{% set fallbackFonts = fontConfig.fallbacks | join(", ") %}
|
{% set fallbackFonts = fontConfig.fallbacks | join(", ") %}
|
||||||
--font-family-{{ fontType }}: {{ fontConfig.family }}, {{ fallbackFonts }};
|
--font-family-{{ fontType }}: {{ fontConfig.family }}, {{ fallbackFonts }};
|
||||||
{% set weights = fontConfig.weights | entries %}
|
{% for weightName, weightConfig in fontConfig.weights %}
|
||||||
{% for weight in weights %}
|
|
||||||
{% set weightName = weight | first %}
|
|
||||||
{% set weightConfig = weight | last %}
|
|
||||||
{% if weightConfig.style != "italic" %}
|
{% if weightConfig.style != "italic" %}
|
||||||
--font-weight-{{ fontType }}-{{ weightName | lower }}: {{ weightConfig.weight }};
|
--font-weight-{{ fontType }}-{{ weightName | lower }}: {{ weightConfig.weight }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
{% set spacingValues = spacing | entries %}
|
{% for keyRaw, value in spacing %}
|
||||||
|
{% set key = keyRaw | replace(".", "\\\.") | safe %}
|
||||||
{% for spaceValue in spacingValues %}
|
|
||||||
{% set key = spaceValue | first | replace(".", "\\\.") | safe %}
|
|
||||||
{% set value = spaceValue | last %}
|
|
||||||
.gap-{{ key }} {
|
.gap-{{ key }} {
|
||||||
gap: {{ value }}px;
|
gap: {{ value }}px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{% set socialLinks = meta.social | entries %}
|
|
||||||
<footer class="[ footer ] [ mt-1.5 py-1.5 ]">
|
<footer class="[ footer ] [ mt-1.5 py-1.5 ]">
|
||||||
<div class="[ footer-grid ] [ wrapper gap-0.5 ]">
|
<div class="[ footer-grid ] [ wrapper gap-0.5 ]">
|
||||||
<p>© {{ meta.author }} 2018-2024.</p>
|
<p>© {{ meta.author }} 2018-2024.</p>
|
||||||
|
@ -17,9 +16,7 @@
|
||||||
<span class="[ visually-hidden ]">RSS</span>
|
<span class="[ visually-hidden ]">RSS</span>
|
||||||
<a href="#" target="_blank">{% include "svgs/rss.svg" %}</a>
|
<a href="#" target="_blank">{% include "svgs/rss.svg" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% for link in socialLinks %}
|
{% for key, url in meta.social %}
|
||||||
{% set key = link | first %}
|
|
||||||
{% set url = link | last %}
|
|
||||||
{% set alt = key | capitalize %}
|
{% set alt = key | capitalize %}
|
||||||
<li>
|
<li>
|
||||||
<span class="[ visually-hidden ]">{{ alt }}</span>
|
<span class="[ visually-hidden ]">{{ alt }}</span>
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
{% set postsByDate = posts | entries %}
|
|
||||||
<section>
|
<section>
|
||||||
{% for postsGroupedByYear in postsByDate %}
|
{% for year, postsByYear in posts %}
|
||||||
{% set year = postsGroupedByYear | first %}
|
|
||||||
{% set postsGroupedByMonth = postsGroupedByYear | last | entries %}
|
|
||||||
{% for postsInMonth in postsGroupedByMonth %}
|
|
||||||
{% set isFirstMonthOfList = loop.index0 === 0 %}
|
|
||||||
{% set month = postsInMonth | first %}
|
|
||||||
<div class="[ flex ]">
|
<div class="[ flex ]">
|
||||||
{% if isFirstMonthOfList %}<h2>{{ year }}</h2>{% endif %}
|
<h2>{{ year }}</h2>
|
||||||
</div>
|
</div>
|
||||||
{% set allPosts = postsInMonth | last %}
|
{% for month, postsByMonth in postsByYear %}
|
||||||
{% for post in allPosts %}
|
{% for post in postsByMonth %}
|
||||||
<div class="[ flex items-center justify-between ]">
|
<div class="[ flex items-center justify-between ]">
|
||||||
<a href="{{ post.url }}">{{ post.data.title }}</a>
|
<a href="{{ post.url }}">{{ post.data.title }}</a>
|
||||||
<div class="[ archive-divider ] [ mx-0.5 ]"></div>
|
<div class="[ archive-divider ] [ mx-0.5 ]"></div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue