stack-site-builder 1.20.0 → 1.22.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/CHANGELOG.md +23 -0
- package/README.md +14 -1
- package/package.json +2 -2
- package/src/layouts/BaseLayout.astro +42 -8
- package/src/lib/home.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,29 @@ content schema, while a consuming site supplies only content, taxonomy data and
|
|
|
11
11
|
config. Sites track the theme with `pnpm up stack-site-builder`, so each release
|
|
12
12
|
here is a plain version bump they pull in.
|
|
13
13
|
|
|
14
|
+
## [1.22.0] - 2026-07-25
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **Cards-home catalog Browse nav** — `home.browse = { href, label?, external? }`:
|
|
19
|
+
on a cards home the stacks catalog Browse nav is hidden (it anchors into the
|
|
20
|
+
catalog home's `#categories` section, which a cards home doesn't have). Set
|
|
21
|
+
`home.browse` to add a header nav item (the same grid icon) that links to a
|
|
22
|
+
separate catalog page instead — e.g. a category browse at `/categories/tools/`.
|
|
23
|
+
`href` is a locale-less internal path (prefixed per locale) or an external URL;
|
|
24
|
+
`label` falls back to the theme's "Browse" string. The catalog home is
|
|
25
|
+
unaffected — it keeps its built-in `#categories` Browse.
|
|
26
|
+
|
|
27
|
+
## [1.21.0] - 2026-07-24
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- **Header brand options** — `site.header = { logo, logoInvert, name }`:
|
|
32
|
+
`logo` (a public/ path) replaces the hardcoded ⚡ bolt with the site's
|
|
33
|
+
mark, `name: false` drops the wordmark for a logo-only brand (the home
|
|
34
|
+
link keeps `site.name` as its aria-label), and `logoInvert` flips a
|
|
35
|
+
black line-art logo in dark mode. Defaults unchanged: ⚡ + site name.
|
|
36
|
+
|
|
14
37
|
## [1.20.0] - 2026-07-24
|
|
15
38
|
|
|
16
39
|
### Added
|
package/README.md
CHANGED
|
@@ -165,7 +165,20 @@ home: {
|
|
|
165
165
|
|
|
166
166
|
Localized values are either one string or a per-locale record with
|
|
167
167
|
default-locale fallback. On a cards home the header's Browse link (which
|
|
168
|
-
anchors into the catalog) hides itself
|
|
168
|
+
anchors into the catalog home's `#categories` section) hides itself — set
|
|
169
|
+
`home.browse` to add it back, pointing at a separate catalog page instead:
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
home: {
|
|
173
|
+
template: 'cards',
|
|
174
|
+
// …
|
|
175
|
+
// Header nav item (grid icon) → a standalone catalog page. Use this when the
|
|
176
|
+
// catalog lives at a category browse rather than on the home. `href` is a
|
|
177
|
+
// locale-less internal path (or an external URL with `external: true`);
|
|
178
|
+
// `label` defaults to the theme's "Browse" string.
|
|
179
|
+
browse: { href: '/categories/tools/', label: { ko: '사용 도구', en: 'Tools' } },
|
|
180
|
+
},
|
|
181
|
+
```
|
|
169
182
|
|
|
170
183
|
## Papers (opt-in)
|
|
171
184
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stack-site-builder",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.22.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The engine behind the awesome-*-stack catalog sites: an Astro theme with the catalog/concepts/articles/slides/samples routes, components, styles and markdown pipeline. Sites provide content, taxonomy data and config.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/CodeComposeStudio/stack-site-builder.git"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"index.mjs",
|
|
@@ -12,7 +12,7 @@ import BackToTop from '../components/BackToTop.astro';
|
|
|
12
12
|
import Footer from '@aas-footer';
|
|
13
13
|
import { getNavPages, pageSlugOf } from '../lib/pages';
|
|
14
14
|
import { getNavProducts, getTopProducts, productSlugOf } from '../lib/products';
|
|
15
|
-
import { homeTemplate } from '../lib/home';
|
|
15
|
+
import { homeTemplate, home as homeConfig, loc } from '../lib/home';
|
|
16
16
|
import { sectionEnabled, type SectionKey } from '../lib/sections';
|
|
17
17
|
import { siteIcons } from '../lib/icons';
|
|
18
18
|
import { privateClientData } from '../lib/private';
|
|
@@ -53,6 +53,14 @@ const base = import.meta.env.BASE_URL;
|
|
|
53
53
|
|
|
54
54
|
const baseNoSlash = base.replace(/\/$/, '');
|
|
55
55
|
|
|
56
|
+
// Header brand: `site.header = { logo?: '/path.png', logoInvert?: bool,
|
|
57
|
+
// name?: bool }`. A logo replaces the ⚡ bolt; `name: false` drops the
|
|
58
|
+
// wordmark (logo-only brand — the link keeps site.name as its aria-label).
|
|
59
|
+
const header = (site as { header?: { logo?: string; logoInvert?: boolean; name?: boolean } })
|
|
60
|
+
.header;
|
|
61
|
+
const brandLogo = header?.logo;
|
|
62
|
+
const brandName = header?.name !== false;
|
|
63
|
+
|
|
56
64
|
// Home URL per locale, for the language auto-detect redirect on the root home.
|
|
57
65
|
const localeHomes = Object.fromEntries(
|
|
58
66
|
(Object.keys(languages) as Lang[]).map((c) => [c, getRelativeLocaleUrl(c, '')]),
|
|
@@ -76,6 +84,10 @@ const showRepoLink =
|
|
|
76
84
|
// layouts never drift: an icon-only row (≥sm) and a labelled dropdown menu
|
|
77
85
|
// (<sm, so a phone header stays to a few controls instead of a long icon run).
|
|
78
86
|
// `svg` is the icon's inner markup (drawn into a shared <svg> shell below).
|
|
87
|
+
// Shared 2×2 grid icon for the catalog Browse nav (catalog home + cards-home
|
|
88
|
+
// `home.browse`).
|
|
89
|
+
const CATALOG_ICON =
|
|
90
|
+
'<rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/>';
|
|
79
91
|
const allNavItems: {
|
|
80
92
|
href: string;
|
|
81
93
|
label: string;
|
|
@@ -84,18 +96,30 @@ const allNavItems: {
|
|
|
84
96
|
keepFilters?: boolean;
|
|
85
97
|
section?: SectionKey;
|
|
86
98
|
}[] = [
|
|
87
|
-
// Browse
|
|
88
|
-
//
|
|
99
|
+
// Browse (grid icon): on the catalog home it anchors into the #categories
|
|
100
|
+
// section; on a cards home it's off unless the site sets `home.browse` to
|
|
101
|
+
// point at a separate catalog page (e.g. a category browse).
|
|
89
102
|
...(homeTemplate === 'catalog'
|
|
90
103
|
? [
|
|
91
104
|
{
|
|
92
105
|
href: `${home}#categories`,
|
|
93
106
|
label: t('nav.browse'),
|
|
94
107
|
keepFilters: true,
|
|
95
|
-
svg:
|
|
108
|
+
svg: CATALOG_ICON,
|
|
96
109
|
},
|
|
97
110
|
]
|
|
98
|
-
:
|
|
111
|
+
: homeConfig?.browse
|
|
112
|
+
? [
|
|
113
|
+
{
|
|
114
|
+
href: homeConfig.browse.external
|
|
115
|
+
? homeConfig.browse.href
|
|
116
|
+
: getRelativeLocaleUrl(lang, homeConfig.browse.href.replace(/^\//, '')),
|
|
117
|
+
label: loc(homeConfig.browse.label, lang) ?? t('nav.browse'),
|
|
118
|
+
external: homeConfig.browse.external,
|
|
119
|
+
svg: CATALOG_ICON,
|
|
120
|
+
},
|
|
121
|
+
]
|
|
122
|
+
: []),
|
|
99
123
|
...(hasProducts
|
|
100
124
|
? [
|
|
101
125
|
{
|
|
@@ -266,9 +290,19 @@ const navItems = allNavItems.filter((item) => !item.section || sectionEnabled(it
|
|
|
266
290
|
aria-label={site.name}
|
|
267
291
|
class="flex min-w-0 items-center gap-1.5 text-base font-bold tracking-tight whitespace-nowrap no-underline sm:text-lg"
|
|
268
292
|
>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
293
|
+
{
|
|
294
|
+
brandLogo ? (
|
|
295
|
+
<img
|
|
296
|
+
src={`${baseNoSlash}${brandLogo}`}
|
|
297
|
+
alt=""
|
|
298
|
+
class:list={['h-7 w-7 shrink-0 object-contain', header?.logoInvert && 'aas-icon-invert']}
|
|
299
|
+
/>
|
|
300
|
+
) : (
|
|
301
|
+
<span aria-hidden="true">⚡</span>
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
{/* Below 600px only the mark remains, so the narrow header never truncates the wordmark. */}
|
|
305
|
+
{brandName && <span class="hidden truncate min-[600px]:inline">{site.name}</span>}
|
|
272
306
|
</a>
|
|
273
307
|
{/* Section links are icon-only (labels live in aria-label). On phones
|
|
274
308
|
(<sm) they collapse into the labelled dropdown menu below, so the
|
package/src/lib/home.ts
CHANGED
|
@@ -45,6 +45,15 @@ export interface HomeConfig {
|
|
|
45
45
|
description?: Localized;
|
|
46
46
|
button?: { label: Localized; href: string; external?: boolean };
|
|
47
47
|
};
|
|
48
|
+
/** Catalog "Browse" nav link for the cards home. The stacks catalog Browse
|
|
49
|
+
* nav anchors into the catalog home's #categories section, so it's hidden on
|
|
50
|
+
* a cards home — set this to add a header nav item that points at a separate
|
|
51
|
+
* catalog page instead (e.g. a category browse at `/categories/tools/`, or a
|
|
52
|
+
* tag/vendor page). `href` is a locale-less internal path (prefixed per
|
|
53
|
+
* locale at render) or an external URL (`external: true`); `label` defaults
|
|
54
|
+
* to the theme's "Browse" string. Ignored on the catalog home, which keeps
|
|
55
|
+
* its built-in #categories Browse. */
|
|
56
|
+
browse?: { href: string; label?: Localized; external?: boolean };
|
|
48
57
|
}
|
|
49
58
|
|
|
50
59
|
export const home: HomeConfig | undefined = (site as { home?: HomeConfig }).home;
|