Comments (7)
As you mentioned above, the plugin currently uses the /items
endpoint.
It sounds like the /items-feed
endpoint is the appropriate endpoint for a plugin like this that should consume all content within the project.
However, the lack of resolution will break our current site and the methods outlined in the linked articles and components won't work for two reasons:
- We make heavy use of the
resolvedUrl
field to create links throughout our site, so if that data won't be available after switching to the/items-feed
endpoint, we'd have to refactor a large portion of our site’s code - The data provided in the
links
field of a Rich Text element doesn’t contain enough data to reconstruct the URLs our content currently uses. For example, the URL Slug is provided, but if the item has a parent entry so that the resolved URL should beparent-url-slug/url-slug
, there is no way to recreate the URL.
This is an example of a resolver that is common across content on our site:
import { ContentItem } from "@kentico/kontent-delivery"
module.exports = class Page extends ContentItem {
constructor() {
super({
urlSlugResolver: (link, context) => {
const entry = context.item
const [parentElement] = entry ? entry.parent_element.value : []
return {
url: `${parentElement ? `/${parentElement.url_slug.value}` : ``}/${
entry.url_slug.value
}`,
}
},
})
}
}
In the case of rich text fields that link to nested content, the unresolved data would like something like this:
{
"data": {
"pages": {
"elements": {
"url_slug": {
"resolvedUrl": "/support/evaluation-forms"
},
"body": {
"value": "<p><strong>Evaluation Forms</strong></p>\n<ul>\n <li>Spiral Form (<a data-item-id=\"dc284d7c-bcd7-4f42-8e93-774060aea8db\" href=\"\">imperial</a> or <a data-item-id=\"9d7226d1-6496-4102-889b-31b61ff99224\" href=\"\">metric</a>)</li></ul>",
"links": [
{
"urlSlug": "spiral-imperial",
"type": "page"
},
{
"urlSlug": "spiral-metric",
"type": "page"
}
],
"resolvedData": {
"html": "<p><strong>Evaluation Forms</strong></p>\n<ul>\n <li>Spiral Form (<a data-item-id=\"dc284d7c-bcd7-4f42-8e93-774060aea8db\" href=\"/support/evaluation-forms/spiral-imperial\">imperial</a> or <a data-item-id=\"9d7226d1-6496-4102-889b-31b61ff99224\" href=\"/support/evaluation-forms/spiral-metric\">metric</a>)</li></ul>"
}
},
}
}
}
}
Where a resolved URL in the body looks like this /support/evaluation-forms/spiral-imperial
the unresolved URL could only be recreated as /page/spiral-imperial
.
To prepare for the Fair Usage Policy change:
Will the JS SDK be updated to handle resolving data for items-feed
or will there be another method or option for sites with more than 1000 items to properly resolve data that was previously handled by the SDK?
from gatsby-packages.
Hello @bwlng,
Thanks for the feedback. Let me first clarify the impact on this source plugin - since the content is loaded per language - the limitation will affect projects with 1000+ per language.
Implementing items-feed
to gatsby source plugin is fairly simple, but the SDK itself currently does not offer item resolution in that endpoint.
We will take a look at your situation try to come up with the solution. I will keep you posted here.
from gatsby-packages.
Thanks @Simply007 — this project is using the following versions of dependencies:
- @kentico/gatsby-source-kontent v4.0.0-beta2
- @kentico/kontent-delivery v8.0.0
from gatsby-packages.
I have created a draft pull request that will fix the issue, once it is unblocked - that means the resolution in the SDK is implemented in items feed endpoint as well. Then the only thing required is the source plugin version update and the useItemsFeedEndpoint
property setting in the gatsby-config.js
file.
We are currently discussing the options we have to not affect the projects that are about to exceed the API limitations. I will keep you updated here!
Your 🥑
from gatsby-packages.
Breaking news 📢
Thanks to the @Enngage and his work in implementing kontent-ai/delivery-sdk-js#275 we have decided to switch from /items
endpoint to /items-feed
endpoint with no breaking changes!
The only action required from you to prevent limitation hit is to update your package version to version 4.3 once it is released.
After the #101 is merged, I am about to release version 4.3.0-beta1 under the items-feed
tag on npm to verify the functionality on your projects.
- I do expect to be done today
from gatsby-packages.
Gatsby source plugin v.4.3.0-beta1 is released (under items-feed
npm tag).
I have tested it out and I haven't spotted any issues.
@bwlng, @jupl - could you please try this version in your project to prevent any issues?
If no issues come out - v4.3 will be released on Thursday (Jan, 23rd).
from gatsby-packages.
Version 4.3.0 is released 💪
from gatsby-packages.
Related Issues (20)
- Gatsby Kontent Components - resolveLink in RichTextElement not getting called HOT 6
- ResolveDomNode for resolving links does not work correctly HOT 2
- Kontent workflow transition generates a preview build. HOT 11
- Image Flickers when conditionally rendering an image using React Context state HOT 13
- Type Error when using TypeScript HOT 7
- Publish webhook body versus Unpublish webhook body. HOT 11
- Allow Gatsby Source Kontent Plugin to filter by collection HOT 18
- Showcase Gatsby SSR and DSG HOT 5
- Unable to use Deferred Static Generation with the Gatsby Source Kontent Plugin HOT 4
- Extend RichText resolver by component flag HOT 23
- Content backups are out of date
- Use new Netlify Gatsby plugin for examples and development site
- Replace Lerna with alternative HOT 2
- Export getGatsbyImageData
- [Spike] Make kontent assets as individual nodes
- Support React 18 in gatsby-components
- Support for content sync from gatsby
- Some observations from profiling Intralox HOT 1
- Asset renditions are not available in the Gatsby data layer HOT 14
- Build and Netlify deployments failing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-packages.