Conversation
|
Loves,
Some critiques,
A few more questions about the URLs,
Regarding extending the schema, this is sort of possible today but I've been quiet about it because I'd rather get these features fixed in CraftQL core and not require uses to patch them in, themselves. Basically, this should all be resolved in core since it's a core bug so thanks for raising it! |
thanks ❤️
I thought the same but for some reason That seems to trip up the automatic resolver. I don't have enough experience to know why. :)
I'm not aware of Craft exposing that in the twig api directly. How would you solve this with the EntryConnection type? I just added the Wrapper type because i wanted to carry the
Nevermind, let's drop it 😄
Mhh… if you deal with That's not a given if you use craft as a headless solution. You could have https://foobar.org (running craft + craftql) and https://example.com (running some kind of app consuming the api). Still your url field contains "https://foobar.org"... which you're not interested in. To achieve the desired result it might be better to remove the hostname from url field instead of rebuilding it from scratch with some
That makes sense. 😁 |
|
Thanks @djfarly!
|
|
Nevermind, I see why {
entries {
uri @withLocale @normalize
}
} |
|
smiles, while deleting the explanation for the uri… 😄 That sounds like a super nice idea. I think it would need to be What would |
|
Oh, |
|
Nice :) Just trying to figure out what this would require:
Do I need to wire it up somewhere else in the code? |
|
@markhuot @djfarly is there any progress on this? or any way I can help to push this forward? Edit: CraftCMS 3.2 now allows querying entries across sites: craftcms/cms@d017022 |
Hej, thank you for this plugin! We're using it to make craft truly headless.
We ran into a few problems that we needed to solve:
urifield is"__home__"for the home page which is not particularly useful if you're not crafturifield does not contain the url prefix from sites (which are used for languages in our case [/en, /de])urlfield does contain the language prefix, but also contains the full url including "https://something.bla/", which again is not particularly helpful since the frontend is not necessarily hosted where the cms isTo solve this I've added some fields:
fullUricontains a fully qualified url no matter what.siteis just the site the entry belongs tosupportedSitesis the array of supportedSites (copied from craft)alternateEntriesis an Array of a new Type calledEntryInterfaceAlternatethat just contains an Entry and a booleanisSelf. The entries are the ones with the same id in all sites where the entry is active. Think of this as enabling you to simply make a site-(/language-)switcher based on that data.languageis just a convenience field that pulls the language from the site. (Yea... kinda unnecessary — I'm actually indifferent about this one)This code is more or less a proof of concept and I'm almost certain that my implementation is not very nice and might have some quirks. Nevertheless I'd love to make CraftQL more helpful for us.
Do you think those (or some of those) additions make sense?
How can I improve them?
If some additions do not make sense... is there a way to extend the Schema like this without needing to fork CraftQL?
Let's talk :)
Screenshot of how it looks currently:
