uniweb 0.3.3 → 0.3.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.
package/README.md
CHANGED
|
@@ -106,7 +106,16 @@ role: Lead Architect
|
|
|
106
106
|
```
|
|
107
107
|
````
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
Access the parsed data via `content.data`:
|
|
110
|
+
|
|
111
|
+
```jsx
|
|
112
|
+
function TeamCard({ content }) {
|
|
113
|
+
const member = content.data['team-member']
|
|
114
|
+
return <div>{member.name} — {member.role}</div>
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Natural content stays in markdown; structured data goes in tagged blocks (YAML or JSON).
|
|
110
119
|
|
|
111
120
|
### Components as React
|
|
112
121
|
|
|
@@ -648,6 +657,76 @@ Yes. Content is pre-embedded in the initial HTML—no fetch waterfalls, no layou
|
|
|
648
657
|
|
|
649
658
|
Pages can define data sources that auto-generate subroutes. A `/blog` page can have an index and a `[slug]` template that renders each post.
|
|
650
659
|
|
|
660
|
+
## Common Gotchas
|
|
661
|
+
|
|
662
|
+
### Homepage Configuration
|
|
663
|
+
|
|
664
|
+
Set your homepage with `index:` in `site.yml`:
|
|
665
|
+
|
|
666
|
+
```yaml
|
|
667
|
+
# site.yml
|
|
668
|
+
index: home # The page folder that becomes /
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
The `index:` option tells the build which page folder becomes the root route (`/`). The page still exists in `pages/home/`, but visitors access it at `/`.
|
|
672
|
+
|
|
673
|
+
Don't confuse this with `pages:` (which explicitly lists pages and hides any not listed).
|
|
674
|
+
|
|
675
|
+
### Content Shapes
|
|
676
|
+
|
|
677
|
+
Lists and items in markdown become **objects**, not strings. A bullet list:
|
|
678
|
+
|
|
679
|
+
```markdown
|
|
680
|
+
- First item
|
|
681
|
+
- Second item
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
Becomes:
|
|
685
|
+
|
|
686
|
+
```js
|
|
687
|
+
content.items = [
|
|
688
|
+
{ title: "First item", paragraphs: [], links: [], imgs: [] },
|
|
689
|
+
{ title: "Second item", paragraphs: [], links: [], imgs: [] }
|
|
690
|
+
]
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
Each item has the same structure as a content block. See [Content Structure](./docs/content-structure.md) for the full shape.
|
|
694
|
+
|
|
695
|
+
### Tagged Data Blocks
|
|
696
|
+
|
|
697
|
+
Tagged code blocks like:
|
|
698
|
+
|
|
699
|
+
````markdown
|
|
700
|
+
```yaml:team-member
|
|
701
|
+
name: Sarah Chen
|
|
702
|
+
role: Lead Architect
|
|
703
|
+
```
|
|
704
|
+
````
|
|
705
|
+
|
|
706
|
+
Are accessible via `content.data`:
|
|
707
|
+
|
|
708
|
+
```jsx
|
|
709
|
+
function TeamMember({ content }) {
|
|
710
|
+
const member = content.data['team-member']
|
|
711
|
+
return <div>{member.name} - {member.role}</div>
|
|
712
|
+
}
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
The tag name (after the colon) becomes the key in `content.data`.
|
|
716
|
+
|
|
717
|
+
### Root vs Package Commands
|
|
718
|
+
|
|
719
|
+
In a Uniweb workspace, commands run differently at different levels:
|
|
720
|
+
|
|
721
|
+
| Location | Command | What it does |
|
|
722
|
+
|----------|---------|--------------|
|
|
723
|
+
| Project root | `pnpm build` | Builds all packages (foundation + site) |
|
|
724
|
+
| Project root | `pnpm dev` | Starts dev server for site |
|
|
725
|
+
| `foundation/` | `uniweb build` | Builds just the foundation |
|
|
726
|
+
| `site/` | `uniweb build` | Builds just the site |
|
|
727
|
+
|
|
728
|
+
For day-to-day development, run `pnpm dev` from the project root. The workspace scripts handle the rest.
|
|
729
|
+
|
|
651
730
|
## Related Packages
|
|
652
731
|
|
|
653
732
|
- [`@uniweb/build`](https://github.com/uniweb/build) — Foundation build tooling
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"js-yaml": "^4.1.0",
|
|
38
38
|
"prompts": "^2.4.2",
|
|
39
39
|
"tar": "^7.0.0",
|
|
40
|
-
"@uniweb/build": "0.2.
|
|
41
|
-
"@uniweb/core": "0.2.
|
|
42
|
-
"@uniweb/
|
|
43
|
-
"@uniweb/
|
|
40
|
+
"@uniweb/build": "0.2.2",
|
|
41
|
+
"@uniweb/core": "0.2.2",
|
|
42
|
+
"@uniweb/runtime": "0.3.0",
|
|
43
|
+
"@uniweb/kit": "0.2.1"
|
|
44
44
|
}
|
|
45
45
|
}
|