Reputation: 1093
There is probably an easy way to do this, but I couldn't find anything about it in the guides:
I have a page called "Logic" and this page has 20 subpages.
Now, in the page "Logic", I'd like to render the title of all those 20 subpages. How can I do that?
Example:
@all-pages-under-logic.each do |page|
= page.title
end
First, I thought that the method render_subnavigation might be useful. But it seems that it only returns elements, that are visible in the navigation.
Upvotes: 1
Views: 181
Reputation: 1093
Answered by tvdeyen from the alchemy cms slack channel:
@children = Alchemy::Page.find_by(page_layout: 'logic').children
titles = @children.pluck(:title)
Upvotes: 2