astro-accelerator 6.1.0 → 6.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "6.1.
|
|
2
|
+
"version": "6.1.2",
|
|
3
3
|
"author": "Steve Fenton",
|
|
4
4
|
"name": "astro-accelerator",
|
|
5
5
|
"description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"linkinator": "^7.6.1"
|
|
54
54
|
},
|
|
55
55
|
"files": [
|
|
56
|
-
".
|
|
56
|
+
"pnpm-workspace.yaml",
|
|
57
57
|
"env.d.ts",
|
|
58
58
|
"tsconfig.json",
|
|
59
59
|
"astro.config.mjs",
|
|
@@ -94,4 +94,4 @@
|
|
|
94
94
|
"zod@<=3.22.2": ">=3.22.3"
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
}
|
|
97
|
+
}
|
package/src/pages/search.md
CHANGED
|
@@ -96,6 +96,19 @@ stats.stop();
|
|
|
96
96
|
position: relative;
|
|
97
97
|
z-index: 100;
|
|
98
98
|
}
|
|
99
|
+
|
|
100
|
+
.site-header .theme-toggle .sun-icon,
|
|
101
|
+
.site-header .theme-toggle .moon-icon {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
body.mode-dark .site-header .theme-toggle .sun-icon {
|
|
106
|
+
display: block;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
body.mode-light .site-header .theme-toggle .moon-icon {
|
|
110
|
+
display: block;
|
|
111
|
+
}
|
|
99
112
|
</style>
|
|
100
113
|
|
|
101
114
|
<header class="site-header">
|
|
@@ -115,14 +128,29 @@ stats.stop();
|
|
|
115
128
|
fill="none"
|
|
116
129
|
stroke-width="1"
|
|
117
130
|
stroke-linecap="round"
|
|
118
|
-
stroke-linejoin="round"
|
|
119
|
-
|
|
120
|
-
<
|
|
121
|
-
<
|
|
122
|
-
<
|
|
123
|
-
<
|
|
124
|
-
<
|
|
125
|
-
></
|
|
131
|
+
stroke-linejoin="round"
|
|
132
|
+
class="sun-icon">
|
|
133
|
+
<circle cx="12" cy="12" r="5"></circle>
|
|
134
|
+
<line x1="12" y1="1" x2="12" y2="3"></line>
|
|
135
|
+
<line x1="12" y1="21" x2="12" y2="23"></line>
|
|
136
|
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
|
|
137
|
+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
|
|
138
|
+
<line x1="1" y1="12" x2="3" y2="12"></line>
|
|
139
|
+
<line x1="21" y1="12" x2="23" y2="12"></line>
|
|
140
|
+
<line x1="4.22" y1="19.07" x2="5.64" y2="17.66"></line>
|
|
141
|
+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
|
|
142
|
+
</svg>
|
|
143
|
+
<svg
|
|
144
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
145
|
+
width="32"
|
|
146
|
+
height="32"
|
|
147
|
+
viewBox="0 0 24 24"
|
|
148
|
+
fill="none"
|
|
149
|
+
stroke-width="1"
|
|
150
|
+
stroke-linecap="round"
|
|
151
|
+
stroke-linejoin="round"
|
|
152
|
+
class="moon-icon">
|
|
153
|
+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
|
|
126
154
|
</svg>
|
|
127
155
|
</a>
|
|
128
156
|
<a
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { PostOrdering, PostFiltering, Accelerator } from 'astro-accelerator-utils';
|
|
5
5
|
import { SITE } from '@config';
|
|
6
|
+
import ArticleList from '@components/ArticleList.astro';
|
|
6
7
|
|
|
7
8
|
const accelerator = new Accelerator(SITE);
|
|
8
9
|
const stats = new accelerator.statistics('accelerator/components/RecentlyUpdated.astro');
|
|
@@ -10,29 +11,28 @@ stats.start();
|
|
|
10
11
|
|
|
11
12
|
// Properties
|
|
12
13
|
type Props = {
|
|
13
|
-
lang
|
|
14
|
+
lang?: string;
|
|
14
15
|
count: number;
|
|
16
|
+
path?: string;
|
|
15
17
|
};
|
|
16
|
-
const { lang, count } = Astro.props satisfies Props;
|
|
18
|
+
const { lang = SITE.default.lang, count, path } = Astro.props satisfies Props;
|
|
17
19
|
|
|
18
20
|
// Logic
|
|
19
21
|
const allPages = accelerator.posts.all();
|
|
20
|
-
const
|
|
22
|
+
const normalizedPath = path
|
|
23
|
+
? `/${path.replace(/^\/+/, '').replace(/\/+$/, '')}`
|
|
24
|
+
: null;
|
|
21
25
|
const pages = allPages
|
|
22
26
|
.filter(PostFiltering.hasDate)
|
|
23
27
|
.filter(PostFiltering.isListable)
|
|
28
|
+
.filter((post) => {
|
|
29
|
+
if (!normalizedPath) return true;
|
|
30
|
+
const postUrl = post.url || '';
|
|
31
|
+
return postUrl === normalizedPath || postUrl.startsWith(`${normalizedPath}/`);
|
|
32
|
+
})
|
|
24
33
|
.sort(PostOrdering.sortByModDateDesc)
|
|
25
|
-
.slice(0,
|
|
34
|
+
.slice(0, count);
|
|
26
35
|
|
|
27
36
|
stats.stop();
|
|
28
37
|
---
|
|
29
|
-
<
|
|
30
|
-
{pages.map((post) => (
|
|
31
|
-
<li data-destination={ accelerator.urlFormatter.formatAddress(post.url) }>
|
|
32
|
-
<a href={ accelerator.urlFormatter.formatAddress(post.url) }>{ accelerator.markdown.getTextFrom(post.frontmatter?.title) }</a>
|
|
33
|
-
<time datetime={ (post.frontmatter.modDate || post.frontmatter.pubDate).toString() }>
|
|
34
|
-
{ accelerator.dateFormatter.formatDate((post.frontmatter.modDate || post.frontmatter.pubDate), lang) }
|
|
35
|
-
</time>
|
|
36
|
-
</li>
|
|
37
|
-
))}
|
|
38
|
-
</ul>
|
|
38
|
+
<ArticleList lang={lang} posts={pages} />
|