astro-accelerator-utils 0.1.8 → 0.1.11
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/lib/navigation.mjs +1 -1
- package/lib/postQueries.mjs +4 -0
- package/lib/v1/posts.d.mts +0 -1
- package/lib/v1/posts.mjs +4 -3
- package/package.json +1 -1
- package/types/Frontmatter.d.ts +29 -1
package/lib/navigation.mjs
CHANGED
|
@@ -69,7 +69,7 @@ export function isNavPage (item) {
|
|
|
69
69
|
export async function getNavigation (currentUrl, site) {
|
|
70
70
|
|
|
71
71
|
const key = 'Navigation__getNavigation';
|
|
72
|
-
const posts = new Posts();
|
|
72
|
+
const posts = new Posts(cache);
|
|
73
73
|
|
|
74
74
|
/** @type {NavPage[]} */
|
|
75
75
|
let pageHierarchy = cache.getItem(key);
|
package/lib/postQueries.mjs
CHANGED
|
@@ -156,6 +156,10 @@ export async function getBreadcrumbs (currentUrl, site) {
|
|
|
156
156
|
const allPages = await getPages();
|
|
157
157
|
|
|
158
158
|
const pathParts = currentUrl.pathname.split('/');
|
|
159
|
+
|
|
160
|
+
if (site.subfolder.length > 0) {
|
|
161
|
+
pathParts.shift();
|
|
162
|
+
}
|
|
159
163
|
|
|
160
164
|
/** @type {NavPage[]} */
|
|
161
165
|
const navPages = [];
|
package/lib/v1/posts.d.mts
CHANGED
package/lib/v1/posts.mjs
CHANGED
|
@@ -12,8 +12,9 @@ export class Posts {
|
|
|
12
12
|
constructor(cache, fetchAll) {
|
|
13
13
|
/* istanbul ignore next */
|
|
14
14
|
this.cache = cache;
|
|
15
|
-
this.fetchAll = fetchAll ?? function() {
|
|
16
|
-
|
|
15
|
+
this.fetchAll = fetchAll ?? function() {
|
|
16
|
+
return import.meta.glob("/src/pages/**/*.md", { eager: true });
|
|
17
|
+
}
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -21,7 +22,7 @@ export class Posts {
|
|
|
21
22
|
* @returns {MarkdownInstance[]}
|
|
22
23
|
*/
|
|
23
24
|
all () {
|
|
24
|
-
const key = '
|
|
25
|
+
const key = 'v1_posts.all';
|
|
25
26
|
|
|
26
27
|
return this.cache.get(key, () => {
|
|
27
28
|
const pageImportResult = this.fetchAll();
|
package/package.json
CHANGED
package/types/Frontmatter.d.ts
CHANGED
|
@@ -1 +1,29 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface Frontmatter {
|
|
2
|
+
layout: string;
|
|
3
|
+
title: string;
|
|
4
|
+
subtitle?: string;
|
|
5
|
+
pubDate: Date;
|
|
6
|
+
modDate?: Date;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
id?: string;
|
|
9
|
+
authors?: string[];
|
|
10
|
+
keywords?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
summary?: string;
|
|
13
|
+
categories?: string[];
|
|
14
|
+
navTitle?: string;
|
|
15
|
+
navSection?: string;
|
|
16
|
+
navOrder?: number;
|
|
17
|
+
bannerImage?: {
|
|
18
|
+
src: string;
|
|
19
|
+
alt: string;
|
|
20
|
+
};
|
|
21
|
+
dir?: 'ltr' | 'rtl';
|
|
22
|
+
lang?: string;
|
|
23
|
+
paged?: boolean;
|
|
24
|
+
navSearch?: boolean;
|
|
25
|
+
navSitemap?: boolean;
|
|
26
|
+
navMenu?: boolean;
|
|
27
|
+
robots?: string;
|
|
28
|
+
redirect?: string;
|
|
29
|
+
}
|