Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 79 additions & 17 deletions _layouts/categories.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ layout: page
<div class="home">
<div id="categories">
<section class="bg"></section>
<ul class="category-clouds">
{% for category in site.categories %}
<a href="#{{ category | first | cgi_escape }}" class="category-anchor">
<li>
{{ category | first }}
<!-- {{ category | last | size | times: 100 | divided_by: site.tags.size | plus: 50 | divided_by: 100.0 }} -->
<!-- <span class="category-number">{{ category | last | size }}</span> -->
</li>
</a>
{% endfor %}
</ul>
<div class="category-list">
<p class="category-links">
{% for category in site.categories %}
<a href="#{{ category | first | cgi_escape }}" class="category-link">{{ category | first }}</a> {{ category | last | size }}{% unless forloop.last %}<span class="separator"> / </span>{% endunless %}
{% endfor %}

{% assign uncategorized_count = 0 %}
{% for post in site.posts %}
{% if post.categories.size == 0 %}
{% assign uncategorized_count = uncategorized_count | plus: 1 %}
{% endif %}
{% endfor %}
{% if uncategorized_count > 0 %}
<span class="separator"> / </span>
<a href="#uncategorized" class="category-link">Uncategorized</a> {{ uncategorized_count }}
{% endif %}
</p>
</div>
<div class="category-groups">
{% for category in site.categories %}
<div class="category-group">
Expand All @@ -28,16 +35,71 @@ layout: page
</h4>
<div class="items">
{% for post in site.categories[group] %}
<a href="{{ post.url | relative_url }}" class="category-post-link">
<div class="item">
<p class="meta">{{ post.date | date: site.data.language.str_date_format | default: '%B %-d, %Y' }}</p>
<p class="title">{{ post.title }}</p>
</div>
</a>
<div class="item-wrapper">
<a href="{{ post.url | relative_url }}" class="category-post-link">
<div class="item">
<div class="item-content">
<p class="meta">{{ post.date | date: site.data.language.str_date_format | default: '%B %-d, %Y' }}</p>
<p class="title">{{ post.title }}</p>
</div>
</div>
</a>
{% if post.tags.size > 0 %}
<div class="item-tags">
{% for tag in post.tags %}
<a href="{{ site.baseurl }}/tags#{{ tag | cgi_escape }}" class="tag-link">
<span class="tag">{{ tag }}</span>
</a>
{% endfor %}
</div>
{% endif %}
</div>
{% endfor %}
</div>
</div>
{% endfor %}

<!-- Uncategorized posts -->
{% assign uncategorized_posts = "" | split: "" %}
{% for post in site.posts %}
{% if post.categories.size == 0 %}
{% assign uncategorized_posts = uncategorized_posts | push: post %}
{% endif %}
{% endfor %}

{% if uncategorized_posts.size > 0 %}
<div class="category-group">
<h4 id="uncategorized" class="title">
Uncategorized
{% if page.showCounts %}
({{uncategorized_posts.size}})
{% endif %}
</h4>
<div class="items">
{% for post in uncategorized_posts %}
<div class="item-wrapper">
<a href="{{ post.url | relative_url }}" class="category-post-link">
<div class="item">
<div class="item-content">
<p class="meta">{{ post.date | date: site.data.language.str_date_format | default: '%B %-d, %Y' }}</p>
<p class="title">{{ post.title }}</p>
</div>
</div>
</a>
{% if post.tags.size > 0 %}
<div class="item-tags">
{% for tag in post.tags %}
<a href="{{ site.baseurl }}/tags#{{ tag | cgi_escape }}" class="tag-link">
<span class="tag">{{ tag }}</span>
</a>
{% endfor %}
</div>
{% endif %}
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
</div>
117 changes: 79 additions & 38 deletions _sass/layouts/_categories.scss
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
#archive,
#categories {
.archive-clouds,
.category-clouds {
margin: 30px 0 30px;
.category-list {
width: 100%;
padding-bottom: $padding-x-small;
text-align: center;

li {
background-color: var(--link);
display: inline-block;
margin-bottom: 10px;
margin-right: 3px;
padding: 0 15px;
border-radius: 20px;
color: var(--header-text);
font-weight: 600;
font-size: 0.8rem;
line-height: 35px;
letter-spacing: -0.03rem;

.category-number {
vertical-align: super;
font-size: 0.625rem;
}

.p {
opacity: 1;
}
.category-links {
margin: 30px 0;
color: var(--meta);
font-size: 0.9em;
}

li:hover {
background-color: var(--header-background) !important;
color: var(--header-text);
.category-link {
color: var(--meta);
text-decoration: underline;
transition: color 0.2s ease;

&:hover {
color: var(--link);
text-decoration: underline;
}
}

.archive-anchor:hover,
.category-anchor:hover {
text-decoration: none !important;
filter: none;
.separator {
color: var(--meta);
}
}

Expand All @@ -50,9 +38,26 @@
.items {
padding-left: $padding-medium;

.item {
.item-wrapper {
position: relative;
margin: 25px 0;
display: flex;
justify-content: space-between;
align-items: center;
gap: 15px;
}

.category-post-link {
flex: 1;
min-width: 0;
text-decoration: none;
}

.item {
.item-content {
flex: 1;
min-width: 0;
}

.meta {
color: var(--meta);
Expand All @@ -65,7 +70,32 @@
}
}

.item::before {
.item-tags {
display: flex;
flex-wrap: wrap;
gap: 5px;
align-items: center;
justify-content: flex-end;

.tag-link {
text-decoration: none;
}

.tag {
background-color: var(--selection);
color: var(--text);
padding: 3px 10px;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 500;
white-space: nowrap;
transition: background-color 0.2s ease, color 0.2s ease, border 0.2s ease;
cursor: pointer;
border: 1px solid transparent;
}
}

.item-wrapper::before {
content: "";
position: absolute;
left: -5%;
Expand All @@ -75,17 +105,28 @@
height: 100%;
}

.archive-post-link:hover,
.item-wrapper:hover::before {
background-color: var(--link);
}

.category-post-link:hover {
text-decoration: none;

.meta, .title {
color: var(--header-background);
color: var(--link);
}
}

.item::before {
background-color: var(--link);
}
.item-wrapper:hover .tag {
background-color: var(--link);
color: var(--header-text);
border-color: transparent;
}

.item-wrapper:hover .tag:hover {
background-color: var(--page-background);
color: var(--link);
border-color: var(--link);
}
}
}
Expand Down
Loading