astro-accelerator-utils 0.0.43 → 0.0.44
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/postFiltering.mjs +17 -4
- package/lib/taxonomy.mjs +2 -1
- package/package.json +1 -1
package/lib/postFiltering.mjs
CHANGED
|
@@ -79,8 +79,21 @@ export function isSearch (p) {
|
|
|
79
79
|
* @returns {boolean}
|
|
80
80
|
*/
|
|
81
81
|
export function isListable (p) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
if (p.url == null || p.url === '') {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (p.frontmatter.layout.includes('/Redirect.astro')) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (p.frontmatter.draft == true) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (Date.parse(p.frontmatter.pubDate) > Date.now()) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return true;
|
|
86
99
|
}
|
package/lib/taxonomy.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Urls from './urls.mjs';
|
|
2
2
|
import * as Cache from './cache.mjs';
|
|
3
3
|
import * as PostQueries from './postQueries.mjs';
|
|
4
|
+
import * as PostFiltering from './postFiltering.mjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @typedef { import("../types/Taxonomy").Taxonomy } Taxonomy
|
|
@@ -65,7 +66,7 @@ export async function getTaxonomy () {
|
|
|
65
66
|
|
|
66
67
|
if (taxonomy == null) {
|
|
67
68
|
/** @type {MarkdownInstance[]} */
|
|
68
|
-
const allPages = await PostQueries.getPages();
|
|
69
|
+
const allPages = await PostQueries.getPages(PostFiltering.isListable);
|
|
69
70
|
|
|
70
71
|
/** @type {{ [key: string]: number }} */
|
|
71
72
|
const tags = {};
|