bunki 0.4.1 → 0.4.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/dist/cli.js +8 -5
- package/dist/index.js +8 -5
- package/dist/site-generator.d.ts +1 -0
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -32988,6 +32988,10 @@ class SiteGenerator {
|
|
|
32988
32988
|
timeZone: "America/Los_Angeles"
|
|
32989
32989
|
}));
|
|
32990
32990
|
}
|
|
32991
|
+
getSortedTags(limit) {
|
|
32992
|
+
const sorted = Object.values(this.site.tags).sort((a, b2) => b2.count - a.count);
|
|
32993
|
+
return limit ? sorted.slice(0, limit) : sorted;
|
|
32994
|
+
}
|
|
32991
32995
|
createPagination(items, currentPage, pageSize, pagePath) {
|
|
32992
32996
|
const totalItems = items.length;
|
|
32993
32997
|
const totalPages = Math.ceil(totalItems / pageSize);
|
|
@@ -33129,7 +33133,7 @@ class SiteGenerator {
|
|
|
33129
33133
|
const yearPageHtml = import_nunjucks.default.render("archive.njk", {
|
|
33130
33134
|
site: this.options.config,
|
|
33131
33135
|
posts: paginatedPosts,
|
|
33132
|
-
tags:
|
|
33136
|
+
tags: this.getSortedTags(this.options.config.maxTagsOnHomepage),
|
|
33133
33137
|
year,
|
|
33134
33138
|
pagination
|
|
33135
33139
|
});
|
|
@@ -33154,7 +33158,7 @@ class SiteGenerator {
|
|
|
33154
33158
|
const pageHtml = import_nunjucks.default.render("index.njk", {
|
|
33155
33159
|
site: this.options.config,
|
|
33156
33160
|
posts: paginatedPosts,
|
|
33157
|
-
tags:
|
|
33161
|
+
tags: this.getSortedTags(this.options.config.maxTagsOnHomepage),
|
|
33158
33162
|
pagination
|
|
33159
33163
|
});
|
|
33160
33164
|
if (page === 1) {
|
|
@@ -33173,8 +33177,7 @@ class SiteGenerator {
|
|
|
33173
33177
|
await ensureDir(postDir);
|
|
33174
33178
|
const postHtml = import_nunjucks.default.render("post.njk", {
|
|
33175
33179
|
site: this.options.config,
|
|
33176
|
-
post
|
|
33177
|
-
tags: Object.values(this.site.tags)
|
|
33180
|
+
post
|
|
33178
33181
|
});
|
|
33179
33182
|
await Bun.write(path5.join(postDir, "index.html"), postHtml);
|
|
33180
33183
|
}
|
|
@@ -33184,7 +33187,7 @@ class SiteGenerator {
|
|
|
33184
33187
|
await ensureDir(tagsDir);
|
|
33185
33188
|
const tagIndexHtml = import_nunjucks.default.render("tags.njk", {
|
|
33186
33189
|
site: this.options.config,
|
|
33187
|
-
tags:
|
|
33190
|
+
tags: this.getSortedTags()
|
|
33188
33191
|
});
|
|
33189
33192
|
await Bun.write(path5.join(tagsDir, "index.html"), tagIndexHtml);
|
|
33190
33193
|
for (const [tagName, tagData] of Object.entries(this.site.tags)) {
|
package/dist/index.js
CHANGED
|
@@ -30860,6 +30860,10 @@ class SiteGenerator {
|
|
|
30860
30860
|
timeZone: "America/Los_Angeles"
|
|
30861
30861
|
}));
|
|
30862
30862
|
}
|
|
30863
|
+
getSortedTags(limit) {
|
|
30864
|
+
const sorted = Object.values(this.site.tags).sort((a, b2) => b2.count - a.count);
|
|
30865
|
+
return limit ? sorted.slice(0, limit) : sorted;
|
|
30866
|
+
}
|
|
30863
30867
|
createPagination(items, currentPage, pageSize, pagePath) {
|
|
30864
30868
|
const totalItems = items.length;
|
|
30865
30869
|
const totalPages = Math.ceil(totalItems / pageSize);
|
|
@@ -31001,7 +31005,7 @@ class SiteGenerator {
|
|
|
31001
31005
|
const yearPageHtml = import_nunjucks.default.render("archive.njk", {
|
|
31002
31006
|
site: this.options.config,
|
|
31003
31007
|
posts: paginatedPosts,
|
|
31004
|
-
tags:
|
|
31008
|
+
tags: this.getSortedTags(this.options.config.maxTagsOnHomepage),
|
|
31005
31009
|
year,
|
|
31006
31010
|
pagination
|
|
31007
31011
|
});
|
|
@@ -31026,7 +31030,7 @@ class SiteGenerator {
|
|
|
31026
31030
|
const pageHtml = import_nunjucks.default.render("index.njk", {
|
|
31027
31031
|
site: this.options.config,
|
|
31028
31032
|
posts: paginatedPosts,
|
|
31029
|
-
tags:
|
|
31033
|
+
tags: this.getSortedTags(this.options.config.maxTagsOnHomepage),
|
|
31030
31034
|
pagination
|
|
31031
31035
|
});
|
|
31032
31036
|
if (page === 1) {
|
|
@@ -31045,8 +31049,7 @@ class SiteGenerator {
|
|
|
31045
31049
|
await ensureDir(postDir);
|
|
31046
31050
|
const postHtml = import_nunjucks.default.render("post.njk", {
|
|
31047
31051
|
site: this.options.config,
|
|
31048
|
-
post
|
|
31049
|
-
tags: Object.values(this.site.tags)
|
|
31052
|
+
post
|
|
31050
31053
|
});
|
|
31051
31054
|
await Bun.write(path5.join(postDir, "index.html"), postHtml);
|
|
31052
31055
|
}
|
|
@@ -31056,7 +31059,7 @@ class SiteGenerator {
|
|
|
31056
31059
|
await ensureDir(tagsDir);
|
|
31057
31060
|
const tagIndexHtml = import_nunjucks.default.render("tags.njk", {
|
|
31058
31061
|
site: this.options.config,
|
|
31059
|
-
tags:
|
|
31062
|
+
tags: this.getSortedTags()
|
|
31060
31063
|
});
|
|
31061
31064
|
await Bun.write(path5.join(tagsDir, "index.html"), tagIndexHtml);
|
|
31062
31065
|
for (const [tagName, tagData] of Object.entries(this.site.tags)) {
|
package/dist/site-generator.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ export interface SiteConfig {
|
|
|
54
54
|
s3?: S3Config;
|
|
55
55
|
/** CSS processing configuration */
|
|
56
56
|
css?: CSSConfig;
|
|
57
|
+
/** Optional number of tags to display on homepage (sorted by count). If not set, all tags are shown */
|
|
58
|
+
maxTagsOnHomepage?: number;
|
|
57
59
|
/** Additional custom configuration options */
|
|
58
60
|
[key: string]: any;
|
|
59
61
|
}
|
package/package.json
CHANGED