Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

structurepage as page() object #6

Open
calebgrove opened this issue Jun 3, 2017 · 3 comments
Open

structurepage as page() object #6

calebgrove opened this issue Jun 3, 2017 · 3 comments

Comments

@calebgrove
Copy link
Owner

As it currently stands, structurepage in the blueprint is set to a string version of the page URI. This is nice and simple, but is very inflexible as it is always tied to one exact page.

Instead, you should be able to use good a 'ol Kirby page selection logic that returns a page object. For example, you could use structurepage: $page->parent() to select the parent of whatever the current page is. This would allow for usage in larger, more complicated websites where a blueprint may be used in many different contexts.

This only issue here is that backwards compatibility would be broken unless we use a new key (structurepage would continue to work as it does, page [for example] would be the newer implementation).

@samnabi
Copy link

samnabi commented Jun 20, 2017

What about using the query keyword, like Kirby's native select field does?

To select from a page URI:

structurepage: page-slug

To select form a dynamic page:

structurepage: query
query: parent

@calebgrove
Copy link
Owner Author

@samnabi Love it, that's probably the best (and most Kirby-like) approach. Now, to find the time to build it...

@samnabi
Copy link

samnabi commented Jun 21, 2017

I'm not sure what other query options would make sense here, without getting into full-fledged PHP filtering functions.

grandparent is too ambiguous (which grandparent?)

sibling is too ambiguous, but nextSibling and previousSibling might work

same for firstChild or lastChild

Just some ideas for your consideration.

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

No branches or pull requests

2 participants