Open NicoHood opened 3 years ago
You should consider playing around with grav 1.7 and flex pages where a lot of work has been done to ease these kind of operations. Flex pages is also a type of flex objects so filtering and sorting is now more advanced.
https://learn.getgrav.org/17/advanced/flex/using/collection
Keep also in mind it won’t be long for 1.7 to be released in the stable channel (https://getgrav.org/blog/grav-17-stable-jan-2020).
That is a good note. The last time I checked flex object (~2 Month ago) there was a note, that using flex pages (in contrast to flex objects) is not recommended, as it is currently (at that time) too slow. Also there was almost no documentation. That that change in the meantime?
Added experimental support for Flex Pages in the frontend (not recommended to use yet)
https://learn.getgrav.org/17/advanced/grav-development/grav-17-upgrade-guide#pages-1
NOTE: Flex Pages feature is not yet used in the frontend of your site.
https://learn.getgrav.org/17/advanced/grav-development/grav-17-upgrade-guide#pages
Added new configuration option to enable Flex Pages in the frontend
- EXPERIMENTAL: Use only for testing purposes!
- system.yaml: pages.type: regular|flex
- Admin: Configuration > System > Experimental > Frontend Page Type
https://learn.getgrav.org/17/advanced/grav-development/grav-17-upgrade-guide#configuration
Isnt this the exact opposite of the following:
Admin uses Flex Pages by default (can be disabled from Flex-Objects plugin)
https://learn.getgrav.org/17/advanced/grav-development/grav-17-upgrade-guide#pages-1
Is this following still the case? Also those two lines sound in contrast to each other to me.
Added experimental support for Flex Users in the frontend (not recommended to use yet) Admin uses Flex Users by default (can be disabled from Flex-Objects plugin)
https://learn.getgrav.org/17/advanced/grav-development/grav-17-upgrade-guide#users
The following tells us that flex pages are used (are they)? However it gives no detail on what hooks needs to get updated and how.
Admin now uses Flex for editing Accounts and Pages. If your plugin hooks into either of those, please make sure they still work.
https://learn.getgrav.org/17/advanced/grav-development/grav-17-upgrade-guide#admin
I also found no documentation how to display flex objects as real pages. I found the example with the contact directory, but I want to display real pages in the end. In my specific use case it would be cool to have a list of e.g. local pizza restaurants in a single directory, but display them a /cities/city/restaurant.html
for example. Also I want to add ratings to each page (or comments) etc via a plugin. I can do that with normal pages, however I dont really see how to realize this with flex objects the same way I currently do.
By the way: I completely missed that blog entry. It seems my thunderbird cannot load new rss feed entries. All other feeds work properly. I've readded the feed and got the new messages now. Not sure if it will work when new blog posts pop up. Weird...
Instead of pages I would just create my custom directory for the restaurants and use it. As you can create your own methods to the collections and objects, everything should be possible.
PS: Flex docs can be found if you change Grav version to 1.7: https://learn.getgrav.org/17/advanced/flex
I am still confused. How can I render a flex object as single page? Each restaurant should have its own page/url. I thought that flex pages are not stable. I think I am understanding things wrong.
I think a skeleton to demonstrate the flex objects would help a lot! I tried the example contact directory. I made some progress, but I think a more detailed example as guideline would help many devs (similar to the quark blog skeleton).
What I am currently missing:
id:ki2ts4cbivggmtlj
but how could I make the template also available on pizzarestaurant
or even berlin/pizzarestaurant
?page.url
in order to render links to specific ids correct. I say the parameter context
, but none of the syntax I tried worked.{% render object layout: options.layout with {page: page} %}
directory:contacts
or id:ki2ts4cbivggmtlj
. The if-else strategy in flex-objects/views/page.html.twig
might not be best for all use cases. Combined with the url question above that would make things easier. For example you specify that restaurants are rendered under /restaurant/name
and always have template restaurant
. Or would I need to write php code and hook up to the pagenotfound event to lookup and serve flex objects?flex-objects.md
. The reason is, that all themes are built for pages, not for objects. What would be the best way to fix such issues? Update the theme?I am sorry for all those questions, I even have problems writing down all questions, as this is so new and complex (at least for new users, even though I know grav quite good now). A detailed example with some variations would be really nice.
id:pizzarestaurant
.See: https://learn.getgrav.org/17/advanced/flex/using#using-flex-objects-page-type
PS: you need to download develop version of the plugin from here: https://github.com/trilbymedia/grav-plugin-flex-objects/
Alright, so "Flex Pages" refers to the flex-objects.md
? If that is the case, and this is called "unstable" what can the flex objects be used for, if not for displaying page content? Maybe it would make sense to draft a few scenarios/usecases in which it would make sense to add flex pages, and how a migration could look like. Maybe a few in theory and one in details (for example migrating the blog into flex objects instead of pages). Just an Idea...
Thanks for your time :-)
No, it does not refer to flex-objects.md
which is a page type. It refers to a new implementation of the whole pages subsystem in Grav. So everything that handles the routing and the pages.
Well, Flex Pages are being used exclusively in the admin. The old pages admin is still available (in case if something is not working), but the new admin is very stable already -- in fact in many cases it works better than the old one.
I found no easy way to sort a page by multiple criteria. For example I want to sort a collection based in
header.rating.average
first and second I want to sort them by name, or date or other options.I did not even find an easy way for a workaround. Is there a chance to add this feature to grav?