astro-accelerator-utils 0.3.64 → 0.3.65
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.d.mts +7 -0
- package/lib/postFiltering.mjs +30 -0
- package/package.json +1 -1
package/lib/postFiltering.d.mts
CHANGED
|
@@ -62,5 +62,12 @@ export function hasModDate(p: MarkdownInstance): boolean;
|
|
|
62
62
|
* @returns {boolean}
|
|
63
63
|
*/
|
|
64
64
|
export function isListable(p: MarkdownInstance<Record<string, any>>): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Predicate for whether a page should be used to create tag and category lists.
|
|
67
|
+
* Specifically, this allows future-dated posts to cause taxonomy pages to be created,
|
|
68
|
+
* @param {MarkdownInstance<Record<string, any>>} p
|
|
69
|
+
* @returns {boolean}
|
|
70
|
+
*/
|
|
71
|
+
export function forTaxonomy(p: MarkdownInstance<Record<string, any>>): boolean;
|
|
65
72
|
export type PagePredicate = import("../types/PagePredicate").PagePredicate;
|
|
66
73
|
export type MarkdownInstance = import("../types/Astro").MarkdownInstance;
|
package/lib/postFiltering.mjs
CHANGED
|
@@ -147,5 +147,35 @@ export function isListable (p) {
|
|
|
147
147
|
return false;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Predicate for whether a page should be used to create tag and category lists.
|
|
155
|
+
* Specifically, this allows future-dated posts to cause taxonomy pages to be created,
|
|
156
|
+
* @param {MarkdownInstance<Record<string, any>>} p
|
|
157
|
+
* @returns {boolean}
|
|
158
|
+
*/
|
|
159
|
+
export function forTaxonomy (p) {
|
|
160
|
+
if (p.url == null || p.url === '') {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (p.frontmatter == null || p.frontmatter.layout == null) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (p.frontmatter.layout.includes('/Redirect.astro')) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (p.frontmatter.listable != null && p.frontmatter.listable == false) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (p.frontmatter.draft == true) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
|
|
150
180
|
return true;
|
|
151
181
|
}
|