Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Way to specify Object path / Routing by Flex Type field #161

Open
dexterxx-pl opened this issue Mar 19, 2022 · 2 comments

Comments

@dexterxx-pl
Copy link

dexterxx-pl commented Mar 19, 2022

Prior to https://learn.getgrav.org/17/advanced/flex/using

Right now there's nice, but basic way to reach each Flex Object by eg. GETting url's like:

https://www.domain.com/directories/directory:contacts/id:ki2ts4cbivggmtlj
https://www.domain.com/contacts/id:ki2ts4cbivggmtlj

Let say my Flex Type is

{
  "id": "string:generated by grav",
  "name": "string",
  ...
}

with example object:

{
  "id": "alotoftrashgenericchars",
  "name": "beauty",
  ...
}

I would like to specify in my blueprint something like:

config:
  site:
    object-url: 'i-am-so-{{name}}'

So I would be able to call on my instance:

https://www.domain.com/contacts/i-am-so-beauty

instead of

https://www.domain.com/contacts/id:alotoftrashgenericchars

which will render for me that object nicely with better seo path.

Possibility to use / in object-url would be also nice to have.

(Let's say for simplifying that let's first just get first matching object and don't bother on eventual duplicates, k?)

@dexterxx-pl
Copy link
Author

BTW

https://www.domain.com/contacts/name:beauty

would be also improvement without adding new config parameter.

@dexterxx-pl
Copy link
Author

I've found that defining key in our storage on specified field

  data:
    storage:
      options:
        indexed: true
        key: fieldname                # in above example the 'name' would be the value
        case_sensitive: false

I may call

https://www.domain.com/contacts/id:beauty

(but no without id:)

I was started to diggin how user accounts are handled by grav itself, so It quite-supports my case

http://www.domain.com/admin/accounts/users/test

but I still dunno...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant