nibula 1.6.0 → 1.6.1
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/.eleventy.js +81 -81
- package/CHANGELOG.md +384 -377
- package/LICENSE +169 -169
- package/NOTICE +4 -4
- package/README.md +110 -110
- package/bin/create.js +505 -505
- package/bin/delegate.js +57 -57
- package/bin/nibula.js +302 -302
- package/docs/Assistant CLI.md +65 -65
- package/docs/Backend.md +201 -201
- package/docs/Components.md +140 -140
- package/docs/Creating pages.md +69 -69
- package/docs/Deploy.md +210 -210
- package/docs/Head and SEO.md +139 -139
- package/docs/Javascript.md +126 -126
- package/docs/Styling with SCSS.md +139 -139
- package/nginx.conf +113 -113
- package/package.json +69 -69
- package/src/backend/.htaccess +6 -6
- package/src/backend/_core/composer.json +5 -5
- package/src/backend/_core/composer.lock +492 -492
- package/src/backend/_core/index.js +267 -267
- package/src/backend/_core/index.php +160 -160
- package/src/backend/_core/init.js +52 -52
- package/src/backend/_core/init.php +33 -33
- package/src/backend/_core/modules/RateLimiter.js +58 -58
- package/src/backend/_core/modules/RateLimiter.php +30 -30
- package/src/backend/_core/modules/Response.js +59 -59
- package/src/backend/_core/modules/Response.php +48 -48
- package/src/backend/api/protected/example-protected.js +23 -23
- package/src/backend/api/protected/example-protected.php +16 -16
- package/src/backend/api/public/example-public.js +24 -24
- package/src/backend/api/public/example-public.php +16 -16
- package/src/backend/database/Database.js +46 -46
- package/src/backend/database/Database.php +23 -23
- package/src/backend/example.config.js +37 -37
- package/src/backend/example.config.php +37 -37
- package/src/backend/package.json +17 -17
- package/src/backend/web.config +43 -43
- package/src/frontend/.htaccess +51 -51
- package/src/frontend/404.njk +17 -17
- package/src/frontend/assets/brand/favicon.svg +54 -54
- package/src/frontend/assets/brand/logo.svg +54 -54
- package/src/frontend/components/global/footer.njk +25 -25
- package/src/frontend/components/global/header.njk +6 -6
- package/src/frontend/components/welcome.njk +115 -115
- package/src/frontend/index.njk +8 -8
- package/src/frontend/js/global.js +10 -10
- package/src/frontend/js/modules/exampleModule.js +2 -2
- package/src/frontend/js/pages/404.js +8 -8
- package/src/frontend/js/pages/homepage.js +8 -8
- package/src/frontend/layouts/base.njk +136 -136
- package/src/frontend/layouts/page-components.njk +13 -13
- package/src/frontend/llms.njk +17 -17
- package/src/frontend/robots.njk +7 -7
- package/src/frontend/scss/_global.scss +46 -46
- package/src/frontend/scss/_root.scss +13 -13
- package/src/frontend/scss/modules/_animations.scss +24 -24
- package/src/frontend/scss/modules/_footer.scss +28 -28
- package/src/frontend/scss/modules/_header.scss +26 -26
- package/src/frontend/scss/modules/_mobile.scss +29 -29
- package/src/frontend/scss/modules/_typography.scss +18 -18
- package/src/frontend/scss/modules/frameworks/_bootstrap.scss +109 -109
- package/src/frontend/scss/modules/frameworks/_bulma.scss +108 -108
- package/src/frontend/scss/modules/frameworks/_foundation.scss +137 -137
- package/src/frontend/scss/modules/frameworks/_uikit.scss +109 -109
- package/src/frontend/scss/pages/404.scss +27 -27
- package/src/frontend/scss/pages/homepage.scss +22 -22
- package/src/frontend/sitemap.njk +17 -17
- package/src/frontend/ts/global.ts +11 -11
- package/src/frontend/ts/modules/exampleModule.ts +2 -2
- package/src/frontend/ts/pages/404.ts +8 -8
- package/src/frontend/ts/pages/homepage.ts +8 -8
- package/src/frontend/web.config +51 -51
- package/tools/assistant.js +122 -122
- package/tools/buildJs.js +39 -39
- package/tools/cleanOutput.js +23 -23
- package/tools/cli/prompt.js +40 -40
- package/tools/cli/ui.js +87 -87
- package/tools/config/messages.json +80 -80
- package/tools/config/settings.json +130 -130
- package/tools/lib/colors.js +17 -17
- package/tools/lib/files.js +75 -75
- package/tools/lib/logger.js +22 -22
- package/tools/lib/outputPath.js +141 -141
- package/tools/lib/pageActions.js +146 -146
- package/tools/lib/pageArtifacts.js +46 -46
- package/tools/lib/pageComponents.js +88 -88
- package/tools/lib/pagesData.js +87 -87
- package/tools/lib/paths.js +63 -63
- package/tools/lib/project.js +54 -54
- package/tools/lib/text.js +47 -47
- package/tools/lib/validation.js +40 -40
- package/tools/res/templates/template.js +7 -7
- package/tools/res/templates/template.njk +8 -8
- package/tools/res/templates/template.scss +22 -22
- package/tools/res/templates/template.ts +8 -8
- package/tsconfig.json +24 -24
- package/src/frontend/scss/pages/prova.scss +0 -23
package/docs/Components.md
CHANGED
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
# Nunjucks (HTML) Components
|
|
2
|
-
|
|
3
|
-
## What is Nunjucks
|
|
4
|
-
|
|
5
|
-
Nunjucks (`.njk`) is an HTML file that supports logic like variables, `if` statements, and `for` loops. It can extend a base layout and include other `.njk` components
|
|
6
|
-
|
|
7
|
-
## Create a component
|
|
8
|
-
|
|
9
|
-
Create a new `.njk` file anywhere inside `src/frontend/components/`. You can organize them into subfolders freely
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
src/frontend/components/
|
|
13
|
-
├── global/
|
|
14
|
-
├── layouts/
|
|
15
|
-
├── modals/
|
|
16
|
-
│ └── privacyModal.njk # You can move it to a modals/subfolder
|
|
17
|
-
├── welcome.njk
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Include a component
|
|
21
|
-
|
|
22
|
-
To render a component inside a page, navigate to `src/frontend/layouts/` and edit `page-components.njk`
|
|
23
|
-
|
|
24
|
-
### page-components.njk <small>(`src/frontend/layouts/`)</small>
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
{% if title == "homepage" %}
|
|
28
|
-
{% include "welcome.njk" %}
|
|
29
|
-
|
|
30
|
-
{% elif title == "examplePage" %}
|
|
31
|
-
{% include "example-component-1.njk" %}
|
|
32
|
-
{% include "subfolder/example-component-2.njk" %}
|
|
33
|
-
|
|
34
|
-
{% else %}
|
|
35
|
-
{% include "404/_404.njk" %}
|
|
36
|
-
{{ content | safe }}
|
|
37
|
-
{% endif %}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Add a new `{% elif %}` block for each page, listing its components in order. If a component lives in a subfolder, specify the relative path accordingly
|
|
41
|
-
|
|
42
|
-
> ⚠️ A new `elif` block is automatically added when you create a page via the Assistant CLI
|
|
43
|
-
|
|
44
|
-
> ⚠️ If you move or delete a component, always update `page-components.njk` or the site will break
|
|
45
|
-
|
|
46
|
-
## Nest components
|
|
47
|
-
|
|
48
|
-
A component can include other components. This is useful for breaking complex sections into smaller, reusable pieces.
|
|
49
|
-
|
|
50
|
-
### exampleComponent.njk
|
|
51
|
-
```js
|
|
52
|
-
<section class="hero">
|
|
53
|
-
{% include "hero/hero-title.njk" %}
|
|
54
|
-
{% include "hero/hero-button.njk" %}
|
|
55
|
-
</section>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
> The same path rules apply: if the included component is in a subfolder, specify the full relative path.
|
|
59
|
-
|
|
60
|
-
## Global components
|
|
61
|
-
|
|
62
|
-
Header and footer live in `src/frontend/components/global/` and are automatically included in every page via `base.njk`. Edit them to change the site-wide layout
|
|
63
|
-
|
|
64
|
-
## Site data in components
|
|
65
|
-
|
|
66
|
-
All values defined in `src/frontend/data/site.json` are globally available in every component via `{{ site.* }}`
|
|
67
|
-
|
|
68
|
-
### site.json <small>(`src/frontend/data/`)</small>
|
|
69
|
-
```json
|
|
70
|
-
"site_name": "Site name",
|
|
71
|
-
"title": "Site title",
|
|
72
|
-
"description": "Site description",
|
|
73
|
-
"keywords": "keyword1, keyword2, keyword3",
|
|
74
|
-
"domain": "yoursite.com",
|
|
75
|
-
"url": "https://yoursite.com",
|
|
76
|
-
"lang": "en",
|
|
77
|
-
"author": "Name and surname",
|
|
78
|
-
"logo": "/assets/brand/logo.svg",
|
|
79
|
-
"legal": {
|
|
80
|
-
"privacy": "", // This is supposed to contain a link
|
|
81
|
-
"cookie": "", // This is supposed to contain a link
|
|
82
|
-
"terms": "", // This is supposed to contain a link
|
|
83
|
-
"copyright": {
|
|
84
|
-
"year": "2026",
|
|
85
|
-
"text": "All rights reserved."
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Usage in any `.njk` file
|
|
90
|
-
```js
|
|
91
|
-
<p>{{ site.title }}</p>
|
|
92
|
-
<a href="{{ site.legal.privacy }}">Privacy Policy</a>
|
|
93
|
-
<img src="{{ site.logo }}" alt="{{ site.title }}">
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Your own data files
|
|
97
|
-
|
|
98
|
-
`site.json` isn't special: **any** `.json` file you drop in `src/frontend/data/` becomes a global variable, and the variable takes the name of the file.
|
|
99
|
-
|
|
100
|
-
Create `test.json`, put anything you want inside it, and every key is reachable as `test.yourKey` — no import, no configuration, no restart.
|
|
101
|
-
|
|
102
|
-
### test.json <small>(`src/frontend/data/`)</small>
|
|
103
|
-
```json
|
|
104
|
-
{
|
|
105
|
-
"testMessage": "This is a test"
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Usage in any `.njk` file
|
|
110
|
-
```js
|
|
111
|
-
<p>{{ test.testMessage }}</p>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Renders as:
|
|
115
|
-
```html
|
|
116
|
-
<p>This is a test</p>
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
That's the whole rule: **file name = variable name, keys inside = what you write after the dot.** `site.json` gives you `site.title` for exactly the same reason.
|
|
120
|
-
|
|
121
|
-
Values can be anything JSON allows, so a list lets you loop instead of copying markup:
|
|
122
|
-
|
|
123
|
-
```json
|
|
124
|
-
{
|
|
125
|
-
"testMessage": "This is a test",
|
|
126
|
-
"links": [
|
|
127
|
-
{ "label": "Home", "url": "/" },
|
|
128
|
-
{ "label": "Contact", "url": "/contact/" }
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
```js
|
|
134
|
-
{% for link in test.links %}
|
|
135
|
-
<a href="{{ link.url }}">{{ link.label }}</a>
|
|
136
|
-
{% endfor %}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Subfolders create nested names: `data/shop/products.json` becomes `{{ shop.products }}`.
|
|
140
|
-
|
|
1
|
+
# Nunjucks (HTML) Components
|
|
2
|
+
|
|
3
|
+
## What is Nunjucks
|
|
4
|
+
|
|
5
|
+
Nunjucks (`.njk`) is an HTML file that supports logic like variables, `if` statements, and `for` loops. It can extend a base layout and include other `.njk` components
|
|
6
|
+
|
|
7
|
+
## Create a component
|
|
8
|
+
|
|
9
|
+
Create a new `.njk` file anywhere inside `src/frontend/components/`. You can organize them into subfolders freely
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
src/frontend/components/
|
|
13
|
+
├── global/
|
|
14
|
+
├── layouts/
|
|
15
|
+
├── modals/
|
|
16
|
+
│ └── privacyModal.njk # You can move it to a modals/subfolder
|
|
17
|
+
├── welcome.njk
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Include a component
|
|
21
|
+
|
|
22
|
+
To render a component inside a page, navigate to `src/frontend/layouts/` and edit `page-components.njk`
|
|
23
|
+
|
|
24
|
+
### page-components.njk <small>(`src/frontend/layouts/`)</small>
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
{% if title == "homepage" %}
|
|
28
|
+
{% include "welcome.njk" %}
|
|
29
|
+
|
|
30
|
+
{% elif title == "examplePage" %}
|
|
31
|
+
{% include "example-component-1.njk" %}
|
|
32
|
+
{% include "subfolder/example-component-2.njk" %}
|
|
33
|
+
|
|
34
|
+
{% else %}
|
|
35
|
+
{% include "404/_404.njk" %}
|
|
36
|
+
{{ content | safe }}
|
|
37
|
+
{% endif %}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Add a new `{% elif %}` block for each page, listing its components in order. If a component lives in a subfolder, specify the relative path accordingly
|
|
41
|
+
|
|
42
|
+
> ⚠️ A new `elif` block is automatically added when you create a page via the Assistant CLI
|
|
43
|
+
|
|
44
|
+
> ⚠️ If you move or delete a component, always update `page-components.njk` or the site will break
|
|
45
|
+
|
|
46
|
+
## Nest components
|
|
47
|
+
|
|
48
|
+
A component can include other components. This is useful for breaking complex sections into smaller, reusable pieces.
|
|
49
|
+
|
|
50
|
+
### exampleComponent.njk
|
|
51
|
+
```js
|
|
52
|
+
<section class="hero">
|
|
53
|
+
{% include "hero/hero-title.njk" %}
|
|
54
|
+
{% include "hero/hero-button.njk" %}
|
|
55
|
+
</section>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> The same path rules apply: if the included component is in a subfolder, specify the full relative path.
|
|
59
|
+
|
|
60
|
+
## Global components
|
|
61
|
+
|
|
62
|
+
Header and footer live in `src/frontend/components/global/` and are automatically included in every page via `base.njk`. Edit them to change the site-wide layout
|
|
63
|
+
|
|
64
|
+
## Site data in components
|
|
65
|
+
|
|
66
|
+
All values defined in `src/frontend/data/site.json` are globally available in every component via `{{ site.* }}`
|
|
67
|
+
|
|
68
|
+
### site.json <small>(`src/frontend/data/`)</small>
|
|
69
|
+
```json
|
|
70
|
+
"site_name": "Site name",
|
|
71
|
+
"title": "Site title",
|
|
72
|
+
"description": "Site description",
|
|
73
|
+
"keywords": "keyword1, keyword2, keyword3",
|
|
74
|
+
"domain": "yoursite.com",
|
|
75
|
+
"url": "https://yoursite.com",
|
|
76
|
+
"lang": "en",
|
|
77
|
+
"author": "Name and surname",
|
|
78
|
+
"logo": "/assets/brand/logo.svg",
|
|
79
|
+
"legal": {
|
|
80
|
+
"privacy": "", // This is supposed to contain a link
|
|
81
|
+
"cookie": "", // This is supposed to contain a link
|
|
82
|
+
"terms": "", // This is supposed to contain a link
|
|
83
|
+
"copyright": {
|
|
84
|
+
"year": "2026",
|
|
85
|
+
"text": "All rights reserved."
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Usage in any `.njk` file
|
|
90
|
+
```js
|
|
91
|
+
<p>{{ site.title }}</p>
|
|
92
|
+
<a href="{{ site.legal.privacy }}">Privacy Policy</a>
|
|
93
|
+
<img src="{{ site.logo }}" alt="{{ site.title }}">
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Your own data files
|
|
97
|
+
|
|
98
|
+
`site.json` isn't special: **any** `.json` file you drop in `src/frontend/data/` becomes a global variable, and the variable takes the name of the file.
|
|
99
|
+
|
|
100
|
+
Create `test.json`, put anything you want inside it, and every key is reachable as `test.yourKey` — no import, no configuration, no restart.
|
|
101
|
+
|
|
102
|
+
### test.json <small>(`src/frontend/data/`)</small>
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"testMessage": "This is a test"
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Usage in any `.njk` file
|
|
110
|
+
```js
|
|
111
|
+
<p>{{ test.testMessage }}</p>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Renders as:
|
|
115
|
+
```html
|
|
116
|
+
<p>This is a test</p>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
That's the whole rule: **file name = variable name, keys inside = what you write after the dot.** `site.json` gives you `site.title` for exactly the same reason.
|
|
120
|
+
|
|
121
|
+
Values can be anything JSON allows, so a list lets you loop instead of copying markup:
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"testMessage": "This is a test",
|
|
126
|
+
"links": [
|
|
127
|
+
{ "label": "Home", "url": "/" },
|
|
128
|
+
{ "label": "Contact", "url": "/contact/" }
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
{% for link in test.links %}
|
|
135
|
+
<a href="{{ link.url }}">{{ link.label }}</a>
|
|
136
|
+
{% endfor %}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Subfolders create nested names: `data/shop/products.json` becomes `{{ shop.products }}`.
|
|
140
|
+
|
|
141
141
|
> ⚠️ Don't reuse a name that already exists. Another file named `site.json` in a subfolder overwrites the original one silently, with no error to point you at the cause.
|
package/docs/Creating pages.md
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
# Creating Pages
|
|
2
|
-
|
|
3
|
-
> Examples use JavaScript, but everything applies equally to TypeScript. The only difference is the file extension (`.ts` instead of `.js`), that imports do **not** include the extension, and that paths use `src/frontend/ts/` instead of `src/frontend/js/`.
|
|
4
|
-
|
|
5
|
-
The recommended way is via the **Assistant CLI**
|
|
6
|
-
|
|
7
|
-
## What gets created
|
|
8
|
-
For a page named `my-page`:
|
|
9
|
-
|
|
10
|
-
| File | Purpose |
|
|
11
|
-
|---|---|
|
|
12
|
-
| `src/frontend/routes/my-page.njk` | Template with front matter |
|
|
13
|
-
| `src/frontend/scss/pages/myPage.scss` | Imports framework + modules |
|
|
14
|
-
| `src/frontend/js/pages/myPage.js` | Imports JS/TS modules |
|
|
15
|
-
|
|
16
|
-
## Adding content
|
|
17
|
-
|
|
18
|
-
1. Create a component in `src/frontend/components/` (e.g. `my-component.njk`)
|
|
19
|
-
2. Include it in `src/frontend/layouts/page-components.njk` inside the generated `elif` block:
|
|
20
|
-
|
|
21
|
-
```njk
|
|
22
|
-
{% elif title == "myPage" %}
|
|
23
|
-
{% include "my-component.njk" ignore missing %}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
See **Components** DOC file for more info
|
|
27
|
-
|
|
28
|
-
## URL and title
|
|
29
|
-
|
|
30
|
-
The URL is the kebab-case name (`/my-page/`). The `title` in the front matter is camelCase (`myPage`) and is used internally to load the correct CSS and JS files — do not change it.
|
|
31
|
-
|
|
32
|
-
## Subpages (nested URLs)
|
|
33
|
-
|
|
34
|
-
To create a URL like `domain.it/about/team`, edit the `permalink` in `src/frontend/routes/team.njk` and add the parent segment before the final slash:
|
|
35
|
-
|
|
36
|
-
```njk
|
|
37
|
-
---
|
|
38
|
-
title: "team"
|
|
39
|
-
permalink: "about/team/"
|
|
40
|
-
layout: page-components.njk
|
|
41
|
-
---
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
The parent path (`about`) does **not** need to exist as a real page — it's just a URL prefix. Only the last segment (`team`) must match the filename and the `title` in the front matter.
|
|
45
|
-
|
|
46
|
-
| Goal URL | permalink value | File |
|
|
47
|
-
|---|---|---|
|
|
48
|
-
| `/team/` | `/team/` | `routes/team.njk` |
|
|
49
|
-
| `/about/team/` | `/about/team/` | `routes/team.njk` |
|
|
50
|
-
| `/company/about/team/` | `/company/about/team/` | `routes/team.njk` |
|
|
51
|
-
|
|
52
|
-
## SEO
|
|
53
|
-
|
|
54
|
-
The CLI creates a stub entry in `src/frontend/data/pages.json`. Fill it in:
|
|
55
|
-
|
|
56
|
-
```json
|
|
57
|
-
"myPage": {
|
|
58
|
-
"seo": {
|
|
59
|
-
"title": "My Page",
|
|
60
|
-
"description": "Description",
|
|
61
|
-
"keywords": "",
|
|
62
|
-
"noindex": false,
|
|
63
|
-
"canonical": ""
|
|
64
|
-
},
|
|
65
|
-
"cdn": {
|
|
66
|
-
"css": [],
|
|
67
|
-
"js": []
|
|
68
|
-
}
|
|
69
|
-
}
|
|
1
|
+
# Creating Pages
|
|
2
|
+
|
|
3
|
+
> Examples use JavaScript, but everything applies equally to TypeScript. The only difference is the file extension (`.ts` instead of `.js`), that imports do **not** include the extension, and that paths use `src/frontend/ts/` instead of `src/frontend/js/`.
|
|
4
|
+
|
|
5
|
+
The recommended way is via the **Assistant CLI**
|
|
6
|
+
|
|
7
|
+
## What gets created
|
|
8
|
+
For a page named `my-page`:
|
|
9
|
+
|
|
10
|
+
| File | Purpose |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `src/frontend/routes/my-page.njk` | Template with front matter |
|
|
13
|
+
| `src/frontend/scss/pages/myPage.scss` | Imports framework + modules |
|
|
14
|
+
| `src/frontend/js/pages/myPage.js` | Imports JS/TS modules |
|
|
15
|
+
|
|
16
|
+
## Adding content
|
|
17
|
+
|
|
18
|
+
1. Create a component in `src/frontend/components/` (e.g. `my-component.njk`)
|
|
19
|
+
2. Include it in `src/frontend/layouts/page-components.njk` inside the generated `elif` block:
|
|
20
|
+
|
|
21
|
+
```njk
|
|
22
|
+
{% elif title == "myPage" %}
|
|
23
|
+
{% include "my-component.njk" ignore missing %}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
See **Components** DOC file for more info
|
|
27
|
+
|
|
28
|
+
## URL and title
|
|
29
|
+
|
|
30
|
+
The URL is the kebab-case name (`/my-page/`). The `title` in the front matter is camelCase (`myPage`) and is used internally to load the correct CSS and JS files — do not change it.
|
|
31
|
+
|
|
32
|
+
## Subpages (nested URLs)
|
|
33
|
+
|
|
34
|
+
To create a URL like `domain.it/about/team`, edit the `permalink` in `src/frontend/routes/team.njk` and add the parent segment before the final slash:
|
|
35
|
+
|
|
36
|
+
```njk
|
|
37
|
+
---
|
|
38
|
+
title: "team"
|
|
39
|
+
permalink: "about/team/"
|
|
40
|
+
layout: page-components.njk
|
|
41
|
+
---
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The parent path (`about`) does **not** need to exist as a real page — it's just a URL prefix. Only the last segment (`team`) must match the filename and the `title` in the front matter.
|
|
45
|
+
|
|
46
|
+
| Goal URL | permalink value | File |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `/team/` | `/team/` | `routes/team.njk` |
|
|
49
|
+
| `/about/team/` | `/about/team/` | `routes/team.njk` |
|
|
50
|
+
| `/company/about/team/` | `/company/about/team/` | `routes/team.njk` |
|
|
51
|
+
|
|
52
|
+
## SEO
|
|
53
|
+
|
|
54
|
+
The CLI creates a stub entry in `src/frontend/data/pages.json`. Fill it in:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
"myPage": {
|
|
58
|
+
"seo": {
|
|
59
|
+
"title": "My Page",
|
|
60
|
+
"description": "Description",
|
|
61
|
+
"keywords": "",
|
|
62
|
+
"noindex": false,
|
|
63
|
+
"canonical": ""
|
|
64
|
+
},
|
|
65
|
+
"cdn": {
|
|
66
|
+
"css": [],
|
|
67
|
+
"js": []
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
70
|
```
|