Skip to content

Commit 3d2c169

Browse files
Add archive section to each page (#546)
1 parent 7b0f854 commit 3d2c169

File tree

4 files changed

+60
-12
lines changed

4 files changed

+60
-12
lines changed

sass/_extra.scss

+12
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,22 @@ a {
103103
color: #767676;
104104
}
105105

106+
.ui.card.archived {
107+
background-color: #f8f8f9;
108+
}
109+
106110
.ui.primary.button, .ui.primary.buttons .button {
107111
background-color: #1F7BC1;
108112
}
109113

114+
.ui.container .ui.message {
115+
margin: .875em .5em;
116+
117+
@media only screen and (max-width: 767px) {
118+
margin: 2em 1em;
119+
}
120+
}
121+
110122
.nolist {
111123
padding-left: 0;
112124
list-style-type: none;

sass/_semantic.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// @import 'semantic/form';
2121
@import 'semantic/grid';
2222
@import 'semantic/menu';
23-
//@import 'semantic/message';
23+
@import 'semantic/message';
2424
// @import 'semantic/table';
2525
// @import 'semantic/ad';
2626
@import 'semantic/card';

templates/categories/macros.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% macro info(item, section) %}
1+
{% macro info(item, section, archived=false) %}
22

33
{% if item.name %}
44
{% set name = item.name %}
@@ -43,7 +43,7 @@
4343
{% set primary_url = repository_url %}
4444
{% endif %}
4545

46-
<li class="ui card">
46+
<li class="ui card{% if archived %} archived{% endif %}">
4747
{% if item.image %}
4848
{% if primary_url %}
4949
<a class="image" href="{{ primary_url }}">

templates/categories/page.html

+45-9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ <h1 class="ui center aligned icon header">
3232
</section>
3333

3434
{# list all content #}
35+
36+
{% set config = load_data(path = "content/" ~ section.path ~ "data.toml", format="toml") %}
37+
38+
{% set crates = [] %}
39+
{% set archived = [] %}
40+
41+
{% for item in config.items %}
42+
{% if item.categories is containing(page.slug) %}
43+
{% if item.archived %}
44+
{% set_global archived = archived | concat(with=item) %}
45+
{% else %}
46+
{% set_global crates = crates | concat(with=item) %}
47+
{% endif %}
48+
{% endif %}
49+
{% endfor %}
50+
3551
<section>
3652
<h2 class="ui horizontal divider small header">
3753
<a href="#{{ section.extra.plural | slugify }}" id="{{ section.extra.plural | slugify }}">
@@ -43,20 +59,40 @@ <h2 class="ui horizontal divider small header">
4359
<div class="ui vertical stripe">
4460
<div class="ui container">
4561
<ul class="ui stackable cards nolist {{ columns }}">
46-
{% set config = load_data(path = "content/" ~ section.path ~ "data.toml", format="toml") %}
47-
48-
{% if config.items %}
49-
{% for item in config.items %}
50-
{% if item.categories is containing(page.slug) %}
51-
{{ category_macros::info(item=item, section=section) }}
52-
{% endif %}
53-
{% endfor %}
54-
{% endif %}
62+
{% for item in crates %}
63+
{{ category_macros::info(item=item, section=section) }}
64+
{% endfor %}
5565
</ul>
5666
</div>
5767
</div>
5868
</section>
5969

70+
{% if archived | length > 0 %}
71+
<section>
72+
<h2 class="ui horizontal divider small header">
73+
<a href="#{{ section.extra.plural | slugify }}" id="{{ section.extra.plural | slugify }}">
74+
<i class="bed icon big"></i>
75+
Archived
76+
</a>
77+
</h2>
78+
79+
<div class="ui vertical stripe">
80+
<div class="ui container">
81+
<div class="ui message">
82+
<i class="info circle icon"></i>
83+
These {{ section.extra.plural }} are no longer maintained, but may still be of interest.
84+
</div>
85+
86+
<ul class="ui stackable cards nolist {{ columns }}">
87+
{% for item in archived %}
88+
{{ category_macros::info(item=item, section=section, archived=true) }}
89+
{% endfor %}
90+
</ul>
91+
</div>
92+
</div>
93+
</section>
94+
{% endif %}
95+
6096
<section>
6197
<h2 class="ui horizontal divider small header">
6298
<a href="#contribute" id="contribute">

0 commit comments

Comments
 (0)