Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Does grav have the concept of relational links (many to many, one to many, etc.)?

Started by Jason 6 years ago · 2 replies · 1134 views
6 years ago

I'm currently using the headless CMS Cockpit, which has the content field type collectionLink, which is a relational field that allows a content author to choose from all of the content entries of the defined content type and select one or multiple.

The headless CMS Directus, allows for one to many, many to one, etc. relational linking, that actually indicates the relationship on both content items linked.

This feature is super helpful for documentation sites, as there is a hierarchy of related content. Does Grav have anything similar or related?

6 years ago

There's a Pages field, which supports multiple option. Although assigning one page to another won't link them as you imagine. That other page won't know it's linked to the first one, unless you also mark it as linked. AFAIK..

6 years ago

@jasonday, Grav is a flat-file CMS and hence only knows about flat files...

Having said that, whatever valid data you can define in JSON or Yaml can be loaded by Grav. That doesn't mean that Grav itself does anything with it, but a custom plugin, or Twig template might interpret the logic in the data.

Or, you could add an RDBMS to store the relations and access the db from a custom plugin.

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Anna, 2 days ago
2 53 16 hours ago
Forms & Blueprints · by Anna, 3 days ago
7 82 16 hours ago
Forms & Blueprints · by Anna, 1 week ago
5 186 6 days ago
Forms & Blueprints · by TomW, 1 month ago
3 379 1 month ago
Forms & Blueprints · by Japhy, 2 months ago
2 595 2 months ago