Comments (7)
Hi @sudhanshu16, you got it.
When you make an 'all' query, the way to filter by the lang is filter - lang - eq - LOCALE
and when you do a regular query, you'll specify cockpitId - eq - ID, lang - eq - LOCALE
. The LOCALE can be any value you put in the locales
option or any
.
I even tried adding locales: ["en"] to the config but no luck so far.
By the way, I have not defined any language in Cockpit (I dont even know how to do that :P)
The locales
option have to be identical to your Cockpit configuration, so if you have locales: ["en"]
, you should have that Cockpit configuration (config.php):
<?php
$configs = [];
$configs['languages'] = [
'default' => 'English',
];
return $configs;
from fika-gatsby-source-cockpit.
Hi @danielmilner,
if you have at least one locale defined in the plugin configuration, you'll get a node for the default language and one for each locale defined (with each localized field translated in the corresponding language). Print or filter by the lang
attribute and you should have only unique nodes ☺.
from fika-gatsby-source-cockpit.
For the default language, use the lang
value any
or any locale defined in the plugin configuration.
from fika-gatsby-source-cockpit.
@WhippetsAintDogs That was it! If I set the local to an empty array in the config, I get one of each node. Thanks!
from fika-gatsby-source-cockpit.
You're welcome! ☺
from fika-gatsby-source-cockpit.
Hey guys,
Can you give an example for the query to run?
I added lang parameter to my query as such:
allCockpitWorks(lang: { eq: "en" }) {
edges {
node {
Title {
value
}
Image {
value {
childImageSharp {
fluid {
...GatsbyImageSharpFluid
}
}
}
}
Description {
value
}
Featured {
value
}
}
}
}
This is giving me the following error:
Unknown argument "lang" on field "allCockpitWorks" of type "Query"
My config looks like this:
{
resolve: "@fika/gatsby-source-cockpit",
options: {
token: "0160ee9ee9f43905a38abe64040c28",
baseUrl: "http://localhost:8888",
collections: []
},
},
I even tried adding locales: ["en"]
to the config but no luck so far.
By the way, I have not defined any language in Cockpit (I dont even know how to do that :P)
from fika-gatsby-source-cockpit.
About the previous comment, I made the query work with the following snippet:
allCockpitWorks(filter: { lang: { eq: "en" } }) {...}
This is what was intended, right? Or is there something else to it too?
from fika-gatsby-source-cockpit.
Related Issues (20)
- Default values for "empty"/"unset fields
- Missing "Meta" on Image-Gallery HOT 2
- error Plugin @fika/gatsby-source-cockpit returned an error HOT 2
- Argument filter has invalid value HOT 1
- How to get the person who last modified an entry HOT 2
- wysiwyg inserted photo does not show up HOT 1
- Undefined returned when trying to access gallery HOT 2
- Tags HOT 3
- Sort Order for Custom Sorted Entries HOT 1
- Error: BaseUrl config parameter is invalid or there is no internet connection HOT 2
- Error when using nested collection entries HOT 4
- Support for populate
- 404 error if you have a singleton with no fields HOT 2
- No value attribute for image and gallery field type HOT 2
- Error when using `collectionLink` component HOT 6
- my inline image of markdown from cockpit cms is not transformed by gatsby-remark-image or by gatsby-remark-images-anywhere HOT 1
- "Invalid asset url" when cockpit is installed in subfolder
- we need update to gatsby 3
- @fika/gatsby-source-cockpit is not compatible with your gatsby version 3.4.1 - It requires [email protected]
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 fika-gatsby-source-cockpit.