Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GrabarzUndPartner/nuxt-page-generator-helper
Generate your pages statically without using payload extractors.
https://github.com/GrabarzUndPartner/nuxt-page-generator-helper
nuxt-module nuxtjs page payload-extractor routes static-site-generator
Last synced: 13 days ago
JSON representation
Generate your pages statically without using payload extractors.
- Host: GitHub
- URL: https://github.com/GrabarzUndPartner/nuxt-page-generator-helper
- Owner: GrabarzUndPartner
- License: mit
- Created: 2020-02-01T13:55:00.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T15:31:45.000Z (7 months ago)
- Last Synced: 2024-04-14T07:43:37.243Z (7 months ago)
- Topics: nuxt-module, nuxtjs, page, payload-extractor, routes, static-site-generator
- Language: JavaScript
- Homepage: https://grabarzundpartner.github.io/nuxt-page-generator-helper/
- Size: 17.2 MB
- Stars: 18
- Watchers: 4
- Forks: 1
- Open Issues: 12
-
Metadata Files:
- Readme: README-ADAPTER.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Adapter
- [Adapter](#adapter)
- [Constants](#constants)
- [PATH](#path)
- [Functions](#functions)
- [_`async`_ getRoutes](#async-getroutes)
- [_`async`_ getRoute](#async-getroute)
- [_`async`_ getLayout](#async-getlayout)
- [Route](#route)## Constants
### PATH
Type: `String`
Default: `__dirname`
**Must be set (required)**
The `PATH` constant must be defined. Is needed for calling the adapter via the plugins.
```javascript
export const PATH = __dirname;
```## Functions
### _`async`_ getRoutes
Gets all routes.
**Arguments:**
| Name | Type | Description |
| -------------- | --------------- | ---------------------------------- |
| locales | `Array` | Languages used (`['de', 'en', …]`) |
| adapterOptions | `Object` | Adapter-Options from `nuxt-config` |**Return:**
```json
[
{
"path": "/index",
"data" : {
"de": {…},
"en" : {…}
}
},
{
"path": "/top-page",
"data" : {
"de": {…},
"en" : {…}
}
},,
{
"path": "/top-page/sub-page",
"data" : {
"de": {…},
"en" : {…}
}
},
…
]
```### _`async`_ getRoute
Used by individual routes in development mode.
**Arguments:**
| Name | Type | Description |
| -------------- | --------------- | ----------------------------------------- |
| route | `Object` | Vue-Router Route |
| path | `String` | Router Path without locale prefix (`/en`) |
| defaultLocale | `String` | Default locale (`de`) |
| locale | `String` | Current locale (`de`) |
| locales | `Array` | Languages used (`['de', 'en', …]`) |
| adapterOptions | `Object` | Adapter-Options from `nuxt-config` |**Return:**
```json
{
"path": "/index",
"data" : {
"de": {},
"en" : {}
}
}
```### _`async`_ getLayout
Gets the layout data.
> Is used in the `nuxtServerInit` of the store to load layout specific data during the rendering > process. (Example: Header, Footer or Cookie-Notification)
**Arguments:**
| Name | Type | Description |
| -------------- | --------------- | ----------------------------------------- |
| route | `Object` | Vue-Router Route |
| path | `String` | Router Path without locale prefix (`/en`) |
| defaultLocale | `String` | Default locale (`de`) |
| locale | `String` | Current locale (`de`) |
| locales | `Array` | Languages used (`['de', 'en', …]`) |
| adapterOptions | `Object` | Adapter-Options from `nuxt-config` |**Return:**
```json
{
"de": {},
"en" : {}
}
```---
## Route
The route object describes a page that is rendered.
A unique path describes the default path of the route, regardless of language variants.
`data` contains the individual language blocks. These describe the respective interpretations of the page (url, title, content).
All described properties must be set.
**Route**
| Property | Description |
| -------- | -------------- |
| `path` | Route Name |
| `data` | Language block |**Language block**
| Property | Description |
| ------------ | ------------------------------------------------------- |
| `url` | Route object for querying the `localPath` method (i18n) |
| `title` | Page title |
| `components` | Page components |```json
{
"path": "/contact",
"data": {
"de": {
"url": {
"path": "/kontakt"
},
"title": "Kontakt",
"components": [
{
"component": "ComponentA",
"data": {}
}
]
},
"en": {
"url": {
"path": "/contact"
},
"title": "Contact",
"components": [
{
"component": "ComponentB",
"data": {}
}
]
}
}
}
```**Component**
| Property | Description |
| ----------- | ----------------------------------------------------- |
| `component` | Component name (relative to property `componentPath`) |
| `data` | Component Data (`props`) |Examples
| Component Path | Component Property Value |
| ----------------------------- | ------------------------ |
| `@component/ComponentA` | `ComponentA` |
| `@component/sub/ComponentSub` | `sub/ComponentSub` |```json
{
"components": [
{
"component": "ComponentA",
"data": {}
}
]
}
```