Skip to content

Commit 559ed4f

Browse files
committed
author search fix; add archive search, filters, rename tags
incorporates: lumeland/theme-simple-blog#40
1 parent cb88e92 commit 559ed4f

File tree

6 files changed

+79
-40
lines changed

6 files changed

+79
-40
lines changed

_data/i18n.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ nav:
44
previous_post: ← Older post
55
continue_reading: Continue reading →
66
archive_title: Archive
7-
archive: More posts can be found in <a href="/archive/">the&nbsp;archive</a>.
7+
archive: Search <a href="/archive/">the&nbsp;archive</a>
8+
archive_search: Search
89
back: ← Back
910
page: Page
1011
next: Next →

_includes/layouts/archive.vto

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,48 @@ bodyClass: body-tag
77
<header class="page-header">
88
<h1 class="page-title">{{ title }}</h1>
99
</header>
10-
<p>
11-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="3" cy="13" r="2" fill="currentColor"/><path d="M14 13C14 6.925 9.075 2 3 2M9 13a6 6 0 0 0-6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg> Feed:
12-
<a href="/feed.xml">Atom</a>, <a href="/feed.json">JSON</a>
13-
</p>
14-
{{ if pagination.page === 1 }}
15-
{{ set pageAuthors = search.pages("type=author pagination.page=1", "author") }}
16-
{{ if pageAuthors.length > 1 }}
17-
<nav class="page-navigation">
18-
<h2>{{ i18n.search.authors }}</h2>
19-
20-
<ul class="page-navigation-tags">
21-
{{ for page of pageAuthors }}
22-
<li><a href="{{ page.url }}" class="badge">{{ page.author }}</a></li>
23-
{{ /for }}
24-
</ul>
25-
</nav>
26-
{{ /if }}
10+
<section class="archive-main">
11+
{{ include "templates/post-list.vto" { postslist: results } }}
12+
<div class="archive-filters">
13+
{{ if pagination.page === 1 }}
14+
{{
15+
set pageAuthors = search.pages("type=author pagination.page=1", "author")
16+
}}
17+
{{ if pageAuthors.length > 1 }}
18+
<nav class="page-navigation">
19+
<h2>{{ i18n.search.authors }}</h2>
2720

28-
{{ set pageTags = search.pages("type=tag pagination.page=1", "tag") }}
29-
{{ if pageTags.length }}
30-
<nav class="page-navigation">
31-
<h2>{{ i18n.search.tags }}<span class="html-only"> 🏷️</span></h2>
32-
33-
<ul class="page-navigation-tags">
34-
{{ for page of pageTags }}
35-
<li><a href="{{ page.url }}" class="badge">{{ page.tag }}</a></li>
36-
{{ /for }}
37-
</ul>
38-
</nav>
39-
{{ /if }}
40-
{{ /if }}
21+
<ul class="page-navigation-tags">
22+
{{ for page of pageAuthors }}
23+
<li>
24+
<a href="{{ page.url }}" class="badge">{{ page.author }}</a>
25+
</li>
26+
{{ /for }}
27+
</ul>
28+
</nav>
29+
{{ /if }}
4130

42-
{{ include "templates/post-list.vto" { postslist: results } }}
31+
{{ set pageTags = search.pages("type=tag pagination.page=1", "tag") }}
32+
{{ if pageTags.length }}
33+
<nav class="page-navigation">
34+
<h2>{{ i18n.search.tags }}<span class="html-only"> 🏷️</span></h2>
35+
36+
<ul class="page-navigation-tags">
37+
{{ for page of pageTags }}
38+
<li>
39+
<a href="{{ page.url }}" class="badge">{{ page.tag }}</a>
40+
</li>
41+
{{ /for }}
42+
</ul>
43+
</nav>
44+
{{ /if }}
45+
{{ /if }}
46+
</div>
47+
</section>
4348
{{ include "templates/pagination.vto" }}
44-
</main>
49+
50+
<hr>
51+
52+
<p class="archive-search">{{ i18n.nav.archive_search }}</p>
53+
<div class="search" id="search"></div>
54+
</main>

_includes/layouts/archive_result.vto

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ bodyClass: body-tag
1010
<p class="nav-back"><a href="/archive/">{{ i18n.nav.back }}</a></p><br>
1111
{{ include "templates/post-list.vto" { postslist: results } }}
1212
{{ include "templates/pagination.vto" }}
13-
</main>
13+
14+
<hr>
15+
16+
<p class="archive-search">{{ i18n.nav.archive_search }}</p>
17+
<div class="search" id="search"></div>
18+
</main>

_includes/layouts/base.vto

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
{{ /for }}
3939
{{- for link of it.menu_links }}
4040
<li>
41-
<a href="{{ link.href }}"{{ if link.target }} target="{{link.target}}"{{ /if }}>
42-
{{ link.text }}
41+
<a href="{{ link.url }}"{{ if link.target }} target="{{link.target}}"{{ /if }}>
42+
{{ link.title }}
4343
</a>
4444
</li>
4545
{{ /for }}
@@ -79,7 +79,13 @@
7979
8080
{{ content }}
8181
82-
<footer class="center">{{ copyright |> md }}</footer>
82+
<footer class="center">
83+
<p class="feed-bar">
84+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="3" cy="13" r="2" fill="currentColor"/><path d="M14 13C14 6.925 9.075 2 3 2M9 13a6 6 0 0 0-6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg> Feed:
85+
<a href="/feed.xml">Atom</a>, <a href="/feed.json">JSON</a>
86+
</p>
87+
{{ copyright |> md }}
88+
</footer>
8389
<!-- Current page: {{ url }} -->
8490
</body>
8591
</html>

_includes/templates/post-details.vto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="post-details">
22
{{ if author }}
3-
{{ set page = search.page(`type=author author="author"`) }}
3+
{{ set page = search.page(`type=author author="${author}"`) }}
44
{{ if page }}
55
<p>{{ i18n.post.by}} <a data-pagefind-filter="author" href="{{ page.url }}">{{ author }}</a></p>
66
{{ else }}
@@ -18,7 +18,7 @@
1818
{{ set page = search.page(`type=tag tag="${tag}"`) }}
1919
2020
{{ if page }}
21-
<a data-pagefind-filter="filter" class="badge" href="{{ page.url }}">{{ tag }}</a>
21+
<a data-pagefind-filter="tag" class="badge" href="{{ page.url }}">{{ tag }}</a>
2222
{{ /if }}
2323
{{ /for }}
2424
</p>

styles.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,30 @@ p {
8484
margin-block: var(--row-gap-xsmall);
8585
}
8686

87+
.feed-bar {
88+
margin-block-end: var(--row-gap-small);
89+
}
90+
8791
.nav-back {
8892
margin-block-end: calc(var(--row-gap-xsmall) / 8);
8993
}
9094

95+
.archive-main {
96+
display: grid;
97+
grid-template-columns: 2fr 1fr;
98+
/* grid-template-rows: 1fr;
99+
grid-template-columns: repeat(2, 1fr);
100+
grid-template-rows: repeat(1, 1fr); */
101+
gap: var(--row-gap-small);
102+
}
103+
104+
.archive-search {
105+
margin-block-start: var(--row-gap-small);
106+
}
107+
91108
/* Page layout */
92109
main {
93-
padding: var(--row-gap-small) 0 var(--row-gap-medium);
110+
padding: var(--row-gap-xsmall) 0 var(--row-gap-medium);
94111
max-width: min(100% - 15vw, 45em);
95112
margin: 0 auto;
96113

0 commit comments

Comments
 (0)