uniweb 1.20.3 → 1.20.4

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.
@@ -1,77 +0,0 @@
1
- ### Adding a New Page
2
-
3
- 1. Create a folder: `site/pages/my-page/`
4
- 2. Add `page.yml`:
5
- ```yaml
6
- title: My Page
7
- ```
8
- 3. Add section files: `1-hero.md`, `2-content.md`, etc.
9
-
10
- ### Section Ordering
11
-
12
- By default, sections are discovered from `.md` files and sorted by numeric prefix (`1-`, `2-`, `3-`).
13
-
14
- **Decimal prefixes** allow inserting sections without renumbering: `2.5-` sorts between `2-` and `3-`.
15
-
16
- For explicit control, use the `sections` property in `page.yml`:
17
-
18
- ```yaml
19
- title: My Page
20
- sections:
21
- - hero
22
- - features
23
- - pricing
24
- ```
25
-
26
- This makes reordering easy (move lines) and allows commenting out sections temporarily.
27
-
28
- **Options:**
29
- - `sections: *` or omit — auto-discover and sort `.md` files by prefix (default)
30
- - `sections: [hero, features]` — explicit ordering, no prefixes needed
31
- - `sections: []` — pure route with no content sections
32
-
33
- ### Section Hierarchy (Subsections)
34
-
35
- For parent-child relationships, use the explicit array with nesting:
36
-
37
- ```yaml
38
- sections:
39
- - hero
40
- - features:
41
- - logocloud
42
- - stats
43
- - pricing
44
- ```
45
-
46
- This is clearer than prefix notation and easier to restructure.
47
-
48
- **Advanced:** Comma prefixes (`1,1-`, `1,2-`) also denote hierarchy, but explicit arrays are recommended for readability.
49
-
50
- ### Page Ordering and Index Pages
51
-
52
- Parent controls which page is the "index" for its route. The index page gets the parent's route.
53
-
54
- **In `site.yml`** (for top-level pages):
55
- ```yaml
56
- name: My Site
57
- pages: [home, about, features] # First (home) is homepage at /
58
- # Or just name the homepage:
59
- index: home
60
- ```
61
-
62
- **In `page.yml`** (for child pages):
63
- ```yaml
64
- title: Documentation
65
- pages: [getting-started, installation, config] # First is index for /docs
66
- # Or just name the index:
67
- index: getting-started
68
- ```
69
-
70
- **How it works:**
71
- - `pages: [a, b, c]` — Explicit order, first item gets parent route
72
- - `index: name` — Just set the index, auto-discover the rest
73
- - Omit both — Sort by `order` prop, lowest becomes index
74
-
75
- **Example:** If `getting-started` is the index for `/docs`:
76
- - `pages/docs/getting-started/` → route `/docs`
77
- - `pages/docs/installation/` → route `/docs/installation`
@@ -1,28 +0,0 @@
1
- ## Developer Guide
2
-
3
- [AGENTS.md](./AGENTS.md) is a comprehensive guide to building with Uniweb — content authoring, component development, theming, configuration, and the kit API. Despite the name, it's written for developers and AI assistants alike. Read it to get productive fast.
4
-
5
- ### AI Prompts
6
-
7
- AI coding assistants (Claude Code, Cursor, Copilot, etc.) read AGENTS.md automatically. Some prompts to try:
8
-
9
- **Converting an existing design:**
10
- ```
11
- I have a landing page design in `homepage.jsx`. Convert it into this Uniweb
12
- project. Decompose each visual section into a foundation component and extract
13
- all text content into markdown files in site/pages/home/. The final page
14
- should render identically to the original. See AGENTS.md for the full guide.
15
- ```
16
-
17
- **Adding a new component:**
18
- ```
19
- Create a Pricing component with 3-column cards. It should support light and
20
- dark themes. Use content.items for the pricing tiers — each item has a title,
21
- paragraph (price), and links (CTA button).
22
- ```
23
-
24
- **Adding a new page:**
25
- ```
26
- Add a /contact page with a hero section and a form section. Reuse the Hero
27
- component from the homepage. Create a new ContactForm component for the form.
28
- ```
@@ -1,13 +0,0 @@
1
- ## Component Documentation
2
-
3
- Generate up-to-date documentation for all foundation components:
4
-
5
- ```bash
6
- # From foundation directory
7
- uniweb docs
8
-
9
- # Or from site directory (auto-detects linked foundation)
10
- cd site && uniweb docs
11
- ```
12
-
13
- This creates `COMPONENTS.md` with details on each component's parameters, presets, and content elements. The documentation is generated from component `meta.js` files, so it's always current.
@@ -1,66 +0,0 @@
1
- ## Configuration Reference
2
-
3
- ### site.yml
4
-
5
- Site-wide configuration in `site/site.yml`:
6
-
7
- ```yaml
8
- name: My Site # Site name
9
- defaultLanguage: en # Default locale code
10
- foundation: foundation # Foundation package name
11
-
12
- # Page ordering (controls top-level navigation)
13
- pages: [home, about, features] # First is homepage at /
14
- # Or just name the homepage:
15
- index: home
16
-
17
- # Internationalization
18
- i18n:
19
- locales: [es, fr] # Non-default locales to build
20
- localesDir: locales # Translation files directory
21
-
22
- # Build options
23
- build:
24
- prerender: true # Enable static site generation
25
- ```
26
-
27
- ### page.yml
28
-
29
- Page-level configuration in `site/pages/[page]/page.yml`:
30
-
31
- ```yaml
32
- title: About Us # Page title (used in <title> and nav)
33
- description: Learn about us # Meta description
34
- label: About # Short nav label (optional)
35
- order: 2 # Navigation sort order
36
-
37
- # Child page ordering
38
- pages: [intro, guide, reference] # First is index for this route
39
- index: intro # Or just name the index
40
-
41
- # Navigation visibility
42
- hidden: true # Hide from all navigation
43
- hideIn: [header] # Hide from named nav areas only (header, footer, sidebar, …)
44
-
45
- # Layout overrides
46
- layout:
47
- header: false # Don't render header
48
- footer: false # Don't render footer
49
-
50
- # Section ordering
51
- sections: # Explicit section order
52
- - hero
53
- - features: # Nested = subsections
54
- - logocloud
55
- - stats
56
- - pricing
57
-
58
- # SEO
59
- seo:
60
- noindex: true
61
- image: /og-image.png
62
- changefreq: monthly
63
- priority: 0.8
64
- ```
65
-
66
- Run `uniweb docs site` or `uniweb docs page` for complete reference.
@@ -1,13 +0,0 @@
1
- ## Deployment
2
-
3
- Build and deploy the `site/dist` folder:
4
-
5
- ```bash
6
- pnpm build
7
- ```
8
-
9
- **Supported platforms:**
10
- - **Vercel**: `cd site && vercel`
11
- - **Netlify**: Build command `pnpm build`, publish `site/dist`
12
- - **GitHub Pages**: Use GitHub Actions
13
- - **Cloudflare Pages**: Connect repo, set `pnpm build` and `site/dist`
@@ -1,6 +0,0 @@
1
- ## Learn More
2
-
3
- - [AGENTS.md](./AGENTS.md) — comprehensive guide to building with Uniweb
4
- - [Uniweb Documentation](https://github.com/uniweb/docs) — full reference docs
5
- - [Uniweb CLI](https://github.com/uniweb/cli) — project scaffolding and build tools
6
- - [Tailwind CSS v4](https://tailwindcss.com)
@@ -1,8 +0,0 @@
1
- ## Quick Start
2
-
3
- ```bash
4
- pnpm install # Install dependencies
5
- pnpm dev # Start development server
6
- ```
7
-
8
- Visit `http://localhost:5173` to see your site.
@@ -1,110 +0,0 @@
1
- ## Search Functionality
2
-
3
- Uniweb sites support full-text search out of the box. Search indexes are generated automatically at build time.
4
-
5
- ### Enabling Search in Your Foundation
6
-
7
- To add search to your site, your foundation needs the **Fuse.js** library:
8
-
9
- ```bash
10
- cd foundation
11
- pnpm add fuse.js
12
- ```
13
-
14
- Then use the search helpers from `@uniweb/kit`:
15
-
16
- ```jsx
17
- import { useSearch } from '@uniweb/kit'
18
-
19
- function SearchComponent({ website }) {
20
- const { query, results, isLoading, clear } = useSearch(website)
21
-
22
- return (
23
- <div>
24
- <input
25
- type="search"
26
- placeholder="Search..."
27
- onChange={e => query(e.target.value)}
28
- />
29
- {isLoading && <span>Searching...</span>}
30
- <ul>
31
- {results.map(result => (
32
- <li key={result.id}>
33
- <a href={result.href}>{result.title}</a>
34
- <p dangerouslySetInnerHTML=\{{ __html: result.snippetHtml }} />
35
- </li>
36
- ))}
37
- </ul>
38
- </div>
39
- )
40
- }
41
- ```
42
-
43
- ### Search Configuration
44
-
45
- Search is enabled by default. To customize, add to `site/site.yml`:
46
-
47
- ```yaml
48
- search:
49
- enabled: true
50
- exclude:
51
- routes: [/admin, /private] # Don't index these routes
52
- components: [Debug] # Don't index these component types
53
- ```
54
-
55
- ### How It Works
56
-
57
- 1. **Build time**: Uniweb extracts text from all pages and sections
58
- 2. **Output**: A `search-index.json` file is generated in `dist/`
59
- 3. **Runtime**: Components fetch and search the index client-side
60
- 4. **Multi-locale**: Each locale gets its own search index
61
-
62
- ### Search API
63
-
64
- The `website` object provides these methods:
65
-
66
- ```javascript
67
- // Check if search is available
68
- website.isSearchEnabled() // Returns boolean
69
-
70
- // Get the URL for the search index
71
- website.getSearchIndexUrl() // "/search-index.json" or "/es/search-index.json"
72
-
73
- // Get full search configuration
74
- website.getSearchConfig() // { enabled, indexUrl, locale, include, exclude }
75
- ```
76
-
77
- ### Search Result Format
78
-
79
- Results from `useSearch()` include:
80
-
81
- | Field | Description |
82
- |-------|-------------|
83
- | `id` | Unique result identifier |
84
- | `type` | `"page"` or `"section"` |
85
- | `route` | Page route |
86
- | `href` | Full link including anchor |
87
- | `title` | Result title |
88
- | `pageTitle` | Parent page title (for sections) |
89
- | `snippetHtml` | Excerpt with `<mark>` highlighted matches |
90
- | `snippetText` | Plain text excerpt |
91
-
92
- ### Without @uniweb/kit
93
-
94
- If you prefer not to use the kit helpers, you can fetch the index directly:
95
-
96
- ```javascript
97
- // Fetch the search index
98
- const response = await fetch(website.getSearchIndexUrl())
99
- const index = await response.json()
100
-
101
- // Use with Fuse.js directly
102
- import Fuse from 'fuse.js'
103
- const fuse = new Fuse(index.entries, {
104
- keys: ['title', 'content'],
105
- threshold: 0.35,
106
- includeMatches: true
107
- })
108
-
109
- const results = fuse.search('your query')
110
- ```