astro-accelerator-utils 0.1.19 → 0.1.20
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/footerMenu.d.mts +7 -3
- package/lib/footerMenu.mjs +12 -9
- package/package.json +1 -1
package/lib/footerMenu.d.mts
CHANGED
|
@@ -21,29 +21,33 @@ export function getMenu(currentUrl: URL, _: TranslationProvider, translations: a
|
|
|
21
21
|
* @param {TranslationProvider} _
|
|
22
22
|
* @param {any} translations
|
|
23
23
|
* @param {Site} site
|
|
24
|
+
* @param {Taxonomy} taxonomy
|
|
24
25
|
* @returns {Promise<NavPage[]>}
|
|
25
26
|
*/
|
|
26
|
-
export function getCategories(links: TaxonomyLinks, _: TranslationProvider, translations: any, site: any): Promise<NavPage[]>;
|
|
27
|
+
export function getCategories(links: TaxonomyLinks, _: TranslationProvider, translations: any, site: any, taxonomy: Taxonomy): Promise<NavPage[]>;
|
|
27
28
|
/**
|
|
28
29
|
*
|
|
29
30
|
* @param {TaxonomyLinks} links
|
|
30
31
|
* @param {TranslationProvider} _
|
|
31
32
|
* @param {any} translations
|
|
32
33
|
* @param {Site} site
|
|
34
|
+
* @param {Taxonomy} taxonomy
|
|
33
35
|
* @returns {Promise<NavPage[]>}
|
|
34
36
|
*/
|
|
35
|
-
export function getTags(links: TaxonomyLinks, _: TranslationProvider, translations: any, site: any): Promise<NavPage[]>;
|
|
37
|
+
export function getTags(links: TaxonomyLinks, _: TranslationProvider, translations: any, site: any, taxonomy: Taxonomy): Promise<NavPage[]>;
|
|
36
38
|
/**
|
|
37
39
|
*
|
|
38
40
|
* @param {TaxonomyLinks} links
|
|
39
41
|
* @param {TranslationProvider} _
|
|
40
42
|
* @param {any} translations
|
|
41
43
|
* @param {Site} site
|
|
44
|
+
* @param {Taxonomy} taxonomy
|
|
42
45
|
* @returns {Promise<NavPage[]>}
|
|
43
46
|
*/
|
|
44
|
-
export function getTopTags(links: TaxonomyLinks, _: TranslationProvider, translations: any, site: any): Promise<NavPage[]>;
|
|
47
|
+
export function getTopTags(links: TaxonomyLinks, _: TranslationProvider, translations: any, site: any, taxonomy: Taxonomy): Promise<NavPage[]>;
|
|
45
48
|
export type NavPage = import("../types/NavPage").NavPage;
|
|
46
49
|
export type Site = import("../types/Astro").Site;
|
|
47
50
|
export type Entry = import("../types/Translations").Entry;
|
|
48
51
|
export type TranslationProvider = import("../types/Translations").TranslationProvider;
|
|
49
52
|
export type TaxonomyLinks = import("../types/Taxonomy").TaxonomyLinks;
|
|
53
|
+
import { Taxonomy } from "./v1/taxonomy.mjs";
|
package/lib/footerMenu.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Cache } from './v1/cache.mjs';
|
|
2
2
|
import { Navigation } from './v1/navigation.mjs';
|
|
3
3
|
import { Posts } from './v1/posts.mjs';
|
|
4
|
+
import { Taxonomy } from './v1/taxonomy.mjs'
|
|
4
5
|
import { UrlFormatter } from './v1/urls.mjs';
|
|
5
6
|
|
|
6
|
-
import * as Taxonomy from './taxonomy.mjs';
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* @typedef { import("../types/NavPage").NavPage } NavPage
|
|
10
9
|
* @typedef { import("../types/Astro").Site } Site
|
|
@@ -27,8 +26,9 @@ export async function getMenu (currentUrl, _, translations, site, menu) {
|
|
|
27
26
|
const cache = new Cache(site.cacheMaxAge);
|
|
28
27
|
const posts = new Posts(cache);
|
|
29
28
|
const urlFormatter = new UrlFormatter(site.url);
|
|
29
|
+
const taxonomy = new Taxonomy(cache, posts, urlFormatter);
|
|
30
30
|
const navigation = new Navigation(posts, urlFormatter);
|
|
31
|
-
const links =
|
|
31
|
+
const links = taxonomy.links(translations, _, site.subfolder);
|
|
32
32
|
|
|
33
33
|
/** @type {NavPage[]} */
|
|
34
34
|
let pages = [];
|
|
@@ -72,9 +72,10 @@ export async function getMenu (currentUrl, _, translations, site, menu) {
|
|
|
72
72
|
* @param {TranslationProvider} _
|
|
73
73
|
* @param {any} translations
|
|
74
74
|
* @param {Site} site
|
|
75
|
+
* @param {Taxonomy} taxonomy
|
|
75
76
|
* @returns {Promise<NavPage[]>}
|
|
76
77
|
*/
|
|
77
|
-
export async function getCategories (links, _, translations, site) {
|
|
78
|
+
export async function getCategories (links, _, translations, site, taxonomy) {
|
|
78
79
|
|
|
79
80
|
const category = _(translations.articles.category) ?? 'category';
|
|
80
81
|
const categoryTitle = _(translations.articles.category_title) ?? 'Categories';
|
|
@@ -82,7 +83,7 @@ export async function getCategories (links, _, translations, site) {
|
|
|
82
83
|
|
|
83
84
|
let order = 0;
|
|
84
85
|
|
|
85
|
-
const taxonomy =
|
|
86
|
+
const taxonomy = taxonomy.getTaxonomy();
|
|
86
87
|
|
|
87
88
|
/** @type {NavPage[]} */
|
|
88
89
|
const pageHierarchy = [{
|
|
@@ -112,9 +113,10 @@ export async function getCategories (links, _, translations, site) {
|
|
|
112
113
|
* @param {TranslationProvider} _
|
|
113
114
|
* @param {any} translations
|
|
114
115
|
* @param {Site} site
|
|
116
|
+
* @param {Taxonomy} taxonomy
|
|
115
117
|
* @returns {Promise<NavPage[]>}
|
|
116
118
|
*/
|
|
117
|
-
export async function getTags (links, _, translations, site) {
|
|
119
|
+
export async function getTags (links, _, translations, site, taxonomy) {
|
|
118
120
|
|
|
119
121
|
const tag = _(translations.articles.tag) ?? 'tag';
|
|
120
122
|
const tagTitle = _(translations.articles.tag_title) ?? 'Tags';
|
|
@@ -122,7 +124,7 @@ export async function getTags (links, _, translations, site) {
|
|
|
122
124
|
|
|
123
125
|
let order = 0;
|
|
124
126
|
|
|
125
|
-
const taxonomy =
|
|
127
|
+
const taxonomy = taxonomy.getTaxonomy();
|
|
126
128
|
|
|
127
129
|
/** @type {NavPage[]} */
|
|
128
130
|
const pageHierarchy = [{
|
|
@@ -152,9 +154,10 @@ export async function getTags (links, _, translations, site) {
|
|
|
152
154
|
* @param {TranslationProvider} _
|
|
153
155
|
* @param {any} translations
|
|
154
156
|
* @param {Site} site
|
|
157
|
+
* @param {Taxonomy} taxonomy
|
|
155
158
|
* @returns {Promise<NavPage[]>}
|
|
156
159
|
*/
|
|
157
|
-
export async function getTopTags (links, _, translations, site) {
|
|
160
|
+
export async function getTopTags (links, _, translations, site, taxonomy) {
|
|
158
161
|
|
|
159
162
|
const tag = _(translations.articles.tag) ?? 'tag';
|
|
160
163
|
const tagTitle = _(translations.articles.tag_title) ?? 'Tags';
|
|
@@ -162,7 +165,7 @@ export async function getTopTags (links, _, translations, site) {
|
|
|
162
165
|
|
|
163
166
|
let order = 0;
|
|
164
167
|
|
|
165
|
-
const taxonomy =
|
|
168
|
+
const taxonomy = taxonomy.getTaxonomy();
|
|
166
169
|
|
|
167
170
|
/** @type {NavPage[]} */
|
|
168
171
|
const pageHierarchy = [{
|