This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated build pipeline to include package step
# Optionally, a longer description of the change(s) giving more context # if necessary.
- Loading branch information
Showing
6 changed files
with
1,594 additions
and
1,747 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,138 @@ | ||
# gridsome-source-kentico-cloud | ||
Kentico Cloud data source plugin for Gridsome. | ||
# @meeg/gridsome-source-kentico-cloud | ||
|
||
[Kentico Cloud](https://kenticocloud.com/) data source plugin for [Gridsome](https://gridsome.org/). | ||
|
||
--- | ||
|
||
## Getting started | ||
|
||
### Install | ||
|
||
Use your preferred package manager to add a dependency on `@meeg/gridsome-source-kentico-cloud` to your project, for example: | ||
|
||
* `yarn add @meeg/gridsome-source-kentico-cloud` | ||
* `npm install @meeg/gridsome-source-kentico-cloud` | ||
|
||
### Basic configuration | ||
|
||
Add `@meeg/gridsome-source-kentico-cloud` to the plugins array in your `gridsome.config.js` file, and configure the Kentico Cloud delivery client to use your [project](https://docs.kenticocloud.com/tutorials/set-up-projects/manage-projects/adding-projects) id: | ||
|
||
```javascript | ||
plugins: [ | ||
{ | ||
use: '@meeg/gridsome-source-kentico-cloud', | ||
options: { | ||
deliveryClientConfig: { | ||
projectId: process.env.KENTICO_CLOUD_PROJECT_ID | ||
} | ||
} | ||
] | ||
``` | ||
> The above configuration assumes that you are using environment variables to manage parts of your project configuration that contain sensitive data (that you do not want to commit to version control), but you can add the project id directly in the configuration if you want. | ||
> | ||
> See the Gridsome docs for general advice on installing [plugins](https://gridsome.org/docs/plugins) and using [environment variables](https://gridsome.org/docs/environment-variables). | ||
This is the minimum configuration required for the plugin to function. For a full description of all configuration options, please keep reading! | ||
## Query your Kentico Cloud data | ||
The following types of collections are made available: | ||
* Content | ||
* Taxonomy | ||
* Assets | ||
> See the Gridsome docs for general advice on [querying data](https://gridsome.org/docs/querying-data). | ||
### Querying content | ||
Content nodes are available by querying collections named using the codename of the [Content type](https://docs.kenticocloud.com/tutorials/set-up-projects/define-content-models/creating-and-deleting-content-types) they belong to converted to pascal case. For example: | ||
* Given the codename `article`, the collection will be named `Article` | ||
* Given the codename `landing_page`, the collection will be named `LandingPage` | ||
> Content [components](https://docs.kenticocloud.com/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components) are also available by querying collections although the nodes in these collections have no route or path as they are not "content" in the usual sense - they are primarily used when resolving Rich Text fields. | ||
> | ||
> Please keep reading for further information about how Rich Text fields are resolved. | ||
#### Fields | ||
The fields of content nodes are named using the codenames of the content elements defined by the Content type the belong to converted to camel case. For example: | ||
* Given the codename `title`, the field will be named `title` | ||
* Given the codename `page_metadata_meta_title`, the field will be named `pageMetadataMetaTitle` | ||
#### System fields | ||
"System" fields provided by the Kentico Cloud delivery client are also available on each content node as well as additional fields added to aid with creating Gridsome collections and nodes. As such, every content node has at least the following fields: | ||
* `id`, | ||
* `name`, | ||
* `codename`, | ||
* `languageCode`, | ||
* `type`, | ||
* The codename of the Kentico Cloud Content type that this Content belongs to | ||
* `typeName` | ||
* The name of the Gridsome collection that this node belongs to | ||
* `route` | ||
* The [route](https://gridsome.org/docs/routing) defined for this Gridsome collection | ||
* If this node's `isComponent` field is `true`, this will always be `null` | ||
* `isComponent` | ||
* `true` if this node represents a Content component; `false` otherwise | ||
* `date` | ||
* This is equal to the system `last_modified` date, but is named `date` because that is the Gridsome convention | ||
* `slug` | ||
* This is set to the value of the "URL slug" Content element if one if defined on the Content type that this Content belongs to; `null` otherwise | ||
* `path` | ||
* This is the path generated by Gridsome based on the route and data of this Content node | ||
#### Field types | ||
TODO: Continue from here... mention that all current elements are supported (but not custom elements?) | ||
--- | ||
- Getting started | ||
- Options | ||
- Delivery client | ||
- [Preview](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#preview-mode) | ||
- [Secure API](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#secured-delivery-api-mode) | ||
- [Language](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#getting-localized-items) | ||
- [Type resolvers](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#initializing-deliveryclient) | ||
- Recommend use of env files | ||
- GridsomeContentItem | ||
- File system convention | ||
- [Models](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#creating-models) | ||
- [Type resolvers](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#initializing-deliveryclient) | ||
- [Property resolver](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#property-binding-in-models) | ||
- Nodes | ||
- Fields | ||
- Common fields | ||
- Taxonomy | ||
- [Linked items](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#strongly-typed-nested-items) | ||
- If possible, avoid content elements with same codename but different types e.g. text and rich text | ||
- Assets | ||
- Routes | ||
- Don't use [link resolver](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#url-slugs-links) | ||
- Links in Rich Text fields | ||
- Extensibility | ||
- Field resolvers | ||
- Field name | ||
- Type | ||
- Default | ||
- Using [Kentico Cloud Model Generator](https://www.npmjs.com/package/kentico-cloud-model-generator-utility) | ||
- Rich text | ||
- Rich Text as dynamic Vue template | ||
- v-runtime-template | ||
- Configuration | ||
- eslint error about unused components | ||
- Content item links | ||
- Item link | ||
- [Content items and components](https://github.com/Kentico/kentico-cloud-js/blob/master/packages/delivery/DOCS.md#resolving-content-items-and-components-in-rich-text-fields) | ||
- Vue components | ||
- Removal of wrapper element | ||
- Prefer "Image" content type over inline assets to give more control | ||
- Link to KC docs mentioning this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.