Hi there!
I would like to show all the artworks related to an artist on the artist page. My current solution works when there is only one artist by artwork, and fails when there are multiple artists.
The content is structured like this:
- Artists
- Artist 1
- Artist 2
- Artworks
- Artwork 1
- Artwork 2
I am using the Artists subpages to populate a multiselect field in Artworks subpages:
artists:
type: multiselect
label: Artist(s)
options: query
query:
fetch: site.index.template("artist").limit(100)
value: "{{ page.title }}"
text: "{{ page.title }}"
translate: false
My code in the artist.php
template:
<?php $artist = $page->title()?>
<?php foreach (page('artworks')->children()->listed()->filterBy('artists', $artist) as $artwork): ?>
...
<?php endforeach ?>
My understanding is I should split the artist field values, but don’t know how to make it happen…