Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Flex-objects in sitemap and url creation

Started by Petr 5 years ago · 3 replies · 715 views
5 years ago

I am testing flex-objects for products and stuff like that. I have clean install of Grav 1.7.5 and default theme and default contacts directory enabled. I have created few contacts for testing purposes.

First question:
I can reach created objects by direct url (directory+id) or by clicking to menu but they are not showing in plugin sitemap. I know that there is no code regarding sitemap in contacts.yaml blueprint for that. Is it okay or something is missing? Do I need to add that functionality by myself or by future plugin version?

Second question is:
Can I change url creation for objects in directory? Default is directory_name/id:object_id viz https://learn.getgrav.org/17/advanced/flex/using. I am looking for something like domain.com/products/product_name (or combination of properties like manufacturer+name+EAN... etc) I know that i can manually create for each product/object speacial page with flex-objects but is there any chance to do that diffrently?

5 years ago

I have the same problem - I have a page called tours and can then link to each object with /tours/id:00aabd5b652b706c36cab112b407acb9 but I'm stuck on how to make URLs that make more sense.

Does anybody have any pointers?

5 years ago

I suppose you could have a plugin, that watches some route (eg. /tours) and it tries to find an object in it. Eg. if you navigate to /tours/some-title, then plugin would try to find an object with a slug some-title and display a page of /tours/id:xxx

Just speculating here :) Don't judge

5 years ago

I'm thinking something similar too - though because Grav Admin uses flex objects I'm guessing there's something in the system files I could hook onto - the closest I could find is getPathFromToken in Utils.php ...

My PHP is very rusty so I'll keep fiddling unless somebody else has already resolved this...

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 48 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 72 2 months ago