bunki 0.18.5 → 0.19.0
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/README.md +83 -1
- package/dist/cli.js +428 -283
- package/dist/fragments/json-ld.njk +59 -0
- package/dist/fragments/og-image.njk +21 -0
- package/dist/fragments/pagination.njk +12 -0
- package/dist/fragments/share-buttons.njk +21 -0
- package/dist/index.js +0 -32886
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -391,6 +391,77 @@ To maximize SEO benefits:
|
|
|
391
391
|
- [Google Search Central - Structured Data](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data)
|
|
392
392
|
- [JSON-LD Official Spec](https://json-ld.org/)
|
|
393
393
|
|
|
394
|
+
## Template Fragments
|
|
395
|
+
|
|
396
|
+
Bunki ships reusable Nunjucks macros called **fragments**. They're registered as a second template search path alongside your site's `templates/` directory, so you can import them from any template without any configuration.
|
|
397
|
+
|
|
398
|
+
### Available fragments
|
|
399
|
+
|
|
400
|
+
| File | Macros | Purpose |
|
|
401
|
+
|------|--------|---------|
|
|
402
|
+
| `og-image.njk` | `og_image(post, site)`, `twitter_image(post, site)` | Open Graph and Twitter Card image meta tags |
|
|
403
|
+
| `json-ld.njk` | `blog_posting_schema(post, site)`, `local_business_schema(post, site)` | Schema.org structured data scripts |
|
|
404
|
+
| `share-buttons.njk` | `share_buttons(post, site)` | X / Facebook / LinkedIn / Email share button row (Tailwind) |
|
|
405
|
+
| `pagination.njk` | `pagination_nav(pagination)` | Previous / Next pagination nav (Tailwind) |
|
|
406
|
+
|
|
407
|
+
### Using fragments
|
|
408
|
+
|
|
409
|
+
Import macros at the top of any template with `{% from %}`:
|
|
410
|
+
|
|
411
|
+
```nunjucks
|
|
412
|
+
{# post.njk #}
|
|
413
|
+
{% from "og-image.njk" import og_image, twitter_image %}
|
|
414
|
+
{% from "json-ld.njk" import blog_posting_schema %}
|
|
415
|
+
|
|
416
|
+
{% block og_image %}{{ og_image(post, site) }}{% endblock %}
|
|
417
|
+
{% block twitter_image %}{{ twitter_image(post, site) }}{% endblock %}
|
|
418
|
+
|
|
419
|
+
{% block head %}
|
|
420
|
+
{{ blog_posting_schema(post, site) }}
|
|
421
|
+
{% endblock %}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
```nunjucks
|
|
425
|
+
{# index.njk, tag.njk, archive.njk #}
|
|
426
|
+
{% from "pagination.njk" import pagination_nav %}
|
|
427
|
+
|
|
428
|
+
{{ pagination_nav(pagination) }}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
The default templates generated by `bunki init` use `og-image.njk` and `json-ld.njk` automatically. The `share-buttons.njk` and `pagination.njk` fragments use Tailwind CSS utility classes and are intended for sites that include Tailwind in their build.
|
|
432
|
+
|
|
433
|
+
### Writing your own fragments
|
|
434
|
+
|
|
435
|
+
Fragments are standard Nunjucks macro files. You can place your own in your site's `templates/` directory and import them the same way — site templates take priority over built-in fragments if names collide.
|
|
436
|
+
|
|
437
|
+
```nunjucks
|
|
438
|
+
{# templates/my-macros.njk #}
|
|
439
|
+
{% macro breadcrumbs(post, site) %}
|
|
440
|
+
<nav aria-label="Breadcrumb">
|
|
441
|
+
<a href="/">Home</a> /
|
|
442
|
+
<span>{{ post.title }}</span>
|
|
443
|
+
</nav>
|
|
444
|
+
{% endmacro %}
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
```nunjucks
|
|
448
|
+
{# templates/post.njk #}
|
|
449
|
+
{% from "my-macros.njk" import breadcrumbs %}
|
|
450
|
+
{{ breadcrumbs(post, site) }}
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Template variables reference
|
|
454
|
+
|
|
455
|
+
| Variable | Available in | Description |
|
|
456
|
+
|----------|-------------|-------------|
|
|
457
|
+
| `site` | All templates | Site config: `title`, `description`, `baseUrl`, `author` |
|
|
458
|
+
| `post` | `post.njk` | Post data: `title`, `excerpt`, `html`, `url`, `date`, `tags`, `tagSlugs`, `image`, `business` |
|
|
459
|
+
| `posts` | `index.njk`, `archive.njk` | Array of post objects |
|
|
460
|
+
| `pagination` | `index.njk`, `tag.njk`, `archive.njk` | `currentPage`, `totalPages`, `hasPrevPage`, `hasNextPage`, `prevPage`, `nextPage`, `pagePath` |
|
|
461
|
+
| `tag` | `tag.njk` | Tag object: `name`, `slug`, `description`, `posts` |
|
|
462
|
+
| `tags` | All templates | Array of tag objects: `name`, `slug`, `count`, `description` |
|
|
463
|
+
| `year` | `archive.njk` | Year string, e.g. `"2025"` |
|
|
464
|
+
|
|
394
465
|
## Image Management
|
|
395
466
|
|
|
396
467
|
### Overview
|
|
@@ -1195,7 +1266,18 @@ bunki/
|
|
|
1195
1266
|
|
|
1196
1267
|
## Changelog
|
|
1197
1268
|
|
|
1198
|
-
### v0.
|
|
1269
|
+
### v0.19.0 (Current)
|
|
1270
|
+
|
|
1271
|
+
- **Template Fragments**: Built-in reusable Nunjucks macros available in all site templates
|
|
1272
|
+
- `og-image.njk` — `og_image(post, site)` and `twitter_image(post, site)` for Open Graph / Twitter Card image tags
|
|
1273
|
+
- `json-ld.njk` — `blog_posting_schema(post, site)` and `local_business_schema(post, site)` for Schema.org structured data
|
|
1274
|
+
- `share-buttons.njk` — `share_buttons(post, site)` for X / Facebook / LinkedIn / Email share buttons (Tailwind)
|
|
1275
|
+
- `pagination.njk` — `pagination_nav(pagination)` for previous/next navigation (Tailwind)
|
|
1276
|
+
- Fragments are registered as a second Nunjucks search path; site templates take priority over built-in fragments
|
|
1277
|
+
- **Improved init templates**: `bunki init` now generates templates with canonical URLs, Open Graph meta tags, Twitter Cards, RSS feed link, share buttons, and JSON-LD structured data out of the box
|
|
1278
|
+
- **Template variables reference**: Added documentation for all variables available in each template type
|
|
1279
|
+
|
|
1280
|
+
### v0.18.1
|
|
1199
1281
|
|
|
1200
1282
|
- **Page Generation Optimization**: Cache JSON-LD schemas and metadata during initialization
|
|
1201
1283
|
- Eliminates 910 redundant operations per build (455 posts × 2)
|