Skip to content

Commit f9f38b8

Browse files
committed
feat: WIP tags feature
1 parent 43c8337 commit f9f38b8

File tree

17 files changed

+151
-98
lines changed

17 files changed

+151
-98
lines changed

_data/config.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
"ogImageUrl": "",
77
"customLinks": [
88
{
9-
"url": "#github",
9+
"url": "#",
1010
"text": "GitHub"
1111
},
1212
{
13-
"url": "#codepen",
14-
"text": "Codepen"
13+
"url": "#",
14+
"text": "CodePen"
15+
},
16+
{
17+
"url": "#",
18+
"text": "LinkedIn"
1519
}
1620
]
1721
}

_includes/simple_page.liquid

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{%- assign breadcrumbMarkup = '' -%}
2+
{%- assign pageUrlStart = page.url | slice: 0,6 -%}
23
{%- assign tocMarkup = content | toc -%}
34
{%- assign pageLang = language | default: config.lang -%}
45
{%- assign pageTitle = title | default: tag | default: page.inputPath -%}
@@ -129,6 +130,7 @@
129130
data-opened-state-class="d-flex fd-column | maxh-sidebar | bc-neutral-100 bwidth-1 bstyle-dashed bcolor-neutral-500">
130131
<menu id="nav_primary_header"
131132
class="d-flex fd-column | pos-sticky top-0 z-1 | m-0 p-0 {% if config.customLinks.size == 0 %}pb-7{% endif %} | ls-none bc-neutral-100 bbwidth-1 bbstyle-dashed bcolor-neutral-500"
133+
gap-5="md"
132134
bradtl-3="md"
133135
bradtr-3="md">
134136
<li class="d-flex ai-center">
@@ -147,7 +149,7 @@
147149
<input id="searchInput"
148150
type="search"
149151
name="search"
150-
class="pl-5 pr-5 pt-3 pb-3 | fs-3 | bc-neutral-100 brad-4 bwidth-1 bstyle-dashed bcolor-neutral-500"
152+
class="pl-5 pr-5 pt-4 pb-4 | fs-3 | bc-neutral-100 brad-4 bwidth-1 bstyle-dashed bcolor-neutral-500"
151153
placeholder="{{ messages.searchPlaceholder[pageLang] }}"
152154
value="">
153155
<div class="d-flex ai-center | pos-absolute top-0 right-0 | h-100 mr-5">
@@ -166,18 +168,30 @@
166168
</form>
167169
</li>
168170
{% if config.customLinks.size > 0 %}
169-
<li class="d-flex ai-center gap-5 | pl-5 pr-5">
171+
<li class="d-flex ai-center fw-wrap">
170172
{% for item in config.customLinks %}
171173
<a href="{{ item.url }}"
172-
class="d-flex ai-center gap-1 | pt-5 pb-5 | fvs-wght-400 fs-2 lh-1 tt-uppercase td-none | c-neutral-900"
174+
class="
175+
d-flex fg-1 {% if config.customLinks.size > 1 %}jc-center{% endif %} ai-center gap-1
176+
pt-5 pb-5 {% if config.customLinks.size == 1 %}pl-5 pr-5{% else %}pl-2 pr-2{% endif %}
177+
fvs-wght-600 fs-1 lsp-3 lh-1 tt-uppercase td-none
178+
c-primary-500
179+
btwidth-1 btstyle-dashed bcolor-neutral-300
180+
{% if forloop.last == false %}brwidth-1 brstyle-dashed bcolor-neutral-300{% endif %}"
173181
target="_blank">
174-
<span class="td-underline">{{ item.text }}</span>
175-
<span class="icon-arrow-square-out"></span>
182+
{{ item.text }}
183+
<span class="icon-arrow-square-out c-primary-300"></span>
176184
</a>
177185
{% endfor %}
178186
</li>
179187
{% endif %}
180188
</menu>
189+
{% if collections.myTags.size > 0 %}
190+
<a href="/tags/"
191+
class="d-flex fg-1 | pos-relative | w-100 pt-4 pb-4 pl-5 pr-5 | fs-4 td-none lh-5 tws-balance fvs-wght-500 | c-neutral-900 bbwidth-1 bbstyle-dashed bcolor-neutral-500">
192+
Tags list
193+
</a>
194+
{% endif %}
181195
{% assign menu = collections.all | eleventyNavigation | eleventyNavigationToHtml: site.navigationOptions %}
182196
{% assign currentPageHrefAttribute = '<a href="' | append: page.url | append: '"' %}
183197
{% capture currentPageReplacementAttribute %}{{ currentPageHrefAttribute }} aria-current="page"{% endcapture %}
@@ -199,7 +213,7 @@
199213
w-100-minus-sidebar="md"
200214
w-100="xs,sm">
201215
{% block content %}
202-
<header class="d-flex fd-column | pt-5 pb-7">
216+
<header class="d-flex fd-column | pt-5 {% if pageUrlStart != '/tags/' %}pb-7{% endif %}">
203217
{{ breadcrumbMarkup }}
204218
<h1 class="mt-3 mb-0 | lsp-5 fvs-wght-700 tws-balance"
205219
fs-10="md"
@@ -216,14 +230,30 @@
216230
</p>
217231
{% endif %}
218232
{% if page.url != '/search/' %}
233+
{% if tags.size > 0 %}
234+
<nav id="page_tags"
235+
class="d-flex gap-2 fw-wrap | pl-5 pt-3 pb-3 | blwidth-1 blstyle-dashed bcolor-neutral-500">
236+
{% for tagName in tags %}
237+
<a href="/tags/{{ tagName }}/"
238+
class="
239+
d-flex ai-center gap-1
240+
pl-2 pr-3 pt-1 pb-1
241+
fs-2 lsp-2 td-none
242+
bc-primary-200 bwidth-1 bstyle-solid bcolor-primary-400 brad-1 bradtl-3 bradbl-3">
243+
<span class="icon-tag-simple"></span>
244+
<span class="page_tag">{{ tagName }}</span>
245+
</a>
246+
{% endfor %}
247+
</nav>
248+
{% endif %}
219249
<div class="d-flex ai-center | m-0 | blwidth-1 blstyle-dashed bcolor-neutral-500">
220250
<div class="pl-5 | bbwidth-1 bbstyle-dashed bcolor-neutral-500"></div>
221251
<p class="d-flex ai-center gap-2 | m-0 pr-2 | fvs-wght-400 fs-3 lsp-3 lh-3 | c-neutral-700"
222252
fs-2="xs">
223253
<span class="icon-calendar-dots fs-6"></span>
224254
<span ws-nowrap="sm,md">
225255
<span class="ws-nowrap">{{ messages.lastModified[pageLang] }}</span>
226-
{{ date | default: site.buildDate }}
256+
{{ page.date|dateString }}
227257
</span>
228258
</p>
229259
<div class="pl-5 w-100 | bbwidth-1 bbstyle-dashed bcolor-neutral-500"></div>

_includes/tags_list.liquid

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{% if collections.myTags.size > 0 %}
2+
<nav>
3+
<ul class="m-0 pl-5 pb-5 | lh-1 | ls-none bwidth-1 bstyle-dashed bcolor-neutral-500 btwidth-0 brwidth-0"
4+
d-flex="xs,sm"
5+
gap-3="xs,sm"
6+
fw-wrap="xs,sm"
7+
columns-3="md"
8+
columns-2="sm">
9+
{% for tagName in collections.myTags %}
10+
<li class="d-flex" mb-2="md">
11+
<a href="/tags/{{ tagName }}/"
12+
class="
13+
d-flex ai-center gap-2
14+
pl-2 pr-3 pt-1 pb-1
15+
fs-3 lsp-2 td-none
16+
bc-primary-200 bwidth-1 bstyle-solid bcolor-primary-400 brad-1 bradtl-3 bradbl-3
17+
{% if tag == tagName %}opa-5{% endif %}">
18+
<span class="icon-tag-simple"></span>
19+
<span>{{ tagName }}</span>
20+
</a>
21+
</li>
22+
{% endfor %}
23+
</ul>
24+
</nav>
25+
{% endif %}

assets/css/ds__defaults.css

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,16 +549,23 @@ main .__search-occurrence {
549549
top: calc(50% - 4px);
550550
left: -4px;
551551
}
552+
#nav_primary li:has([href="/tags/"]) {
553+
display: none;
554+
}
552555

553556
/* MAIN TABLE OF CONTENT */
554-
#toc_main[open] > summary {
557+
#toc_main[open] > summary,
558+
#tags_list[open] > summary {
555559
border-bottom: none;
556560
}
557561
#toc_main[open] > summary .icon-plus-circle,
558-
#toc_main:not([open]) > summary .icon-minus-circle {
562+
#toc_main:not([open]) > summary .icon-minus-circle,
563+
#tags_list[open] > summary .icon-plus-circle,
564+
#tags_list:not([open]) > summary .icon-minus-circle {
559565
display: none;
560566
}
561-
#toc_main li {
567+
#toc_main li,
568+
#tags_list li {
562569
break-inside: avoid;
563570
}
564571

assets/js/ui.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ const libdocUi = {
261261
if (location.pathname == '/search/') {
262262
document.title += ` “${textQuery}“`;
263263
history.replaceState(null, '', `?search=${textQuery}`);
264-
} else {
264+
} else if (location.pathname.indexOf("/tags/") !== 0) {
265265
libdocUi.searchContent(textQuery);
266266
}
267267
libdocUi.el.searchInputs.forEach(function(elInput) {
@@ -658,7 +658,7 @@ const libdocUi = {
658658
libdocUi._so.els = [];
659659
const queryLC = query.toLowerCase();
660660
// Every child of main excepting pre, aside and header
661-
document.querySelectorAll('main>*:not(pre):not(aside):not(header), main>*:not(pre):not(aside):not(header) *').forEach(function(el) {
661+
document.querySelectorAll('main>*:not(pre):not(aside):not(header), main>*:not(pre):not(aside):not(header) *, .page_tag').forEach(function(el) {
662662
const textContentWoChildren = libdocUi.getTextContentWithoutChildNodes(el);
663663
if (textContentWoChildren.toLowerCase().includes(queryLC)) {
664664
libdocUi._so.els.push(el);

content/examples/index.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@
22
# title: Mon titre
33
description: Usage examples of Eleventy LibDoc
44
layout: simple_page.liquid
5-
lang: fr
6-
date: "2020-01-01"
75
tags:
8-
- tag2
9-
- tag1
6+
- cool
7+
- first
8+
- sqdkl
9+
- qskdj
10+
- zeiorz zr
11+
- cToggle
12+
- met
13+
- en
14+
- relation
15+
- des
16+
- éléments
17+
- de à
18+
- DOM
19+
- déclencheurs
20+
1021
eleventyNavigation:
1122
key: Documentation examples
1223
parent: Sandbox from file

content/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ title: Eleventy LibDoc
33
description: Just and Eleventy SSG starter project to create documentation website
44
layout: simple_page.liquid
55
permalink: index.html
6-
tags:
7-
- tag1
8-
- tag2
6+
97
---
108
{{ site.name | json }}
119
## Headers

content/samples/bricss.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
# title: Mon titre
33
layout: simple_page.liquid
4-
tags:
5-
- cool
4+
tags: DOM
65
eleventyNavigation:
76
key: BRiCSS Documentation
87
parent: Samples

content/samples/front-matter.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
---
22
# title: Mon titre
33
layout: simple_page.liquid
4-
tags:
5-
- tag2
6-
- tag1
74
eleventyNavigation:
85
key: Front Matter
96
parent: Samples

content/samples/frontend-links-2.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
# title: Mon titre
33
description: A second copy of my own bookmarks, curated list of useful front-end tools, libraries, etc.
44
layout: simple_page.liquid
5-
tags:
6-
- tag2
7-
- tag1
85
eleventyNavigation:
96
key: Frontend links 2
107
parent: Samples

0 commit comments

Comments
 (0)