Get article data to slider from chosen articles


#1

Hallo,
I have a articles site.
On homepage i want to show chosen articles.
I thought about simple solution with a structure field with article url’s in blueprint, but i don’t know how get data from chosen article (url) in template.

Thank you for attention


#2

You can use a structure field, but I’d suggest the relationship field for this.

Then in your blueprint:


selectedArticles:
  label: Selected articles
  type: relationship
  options: query
  query:
    page: articles
    fetch: children
    value: '{{ uri }}'

And in your template:

$selectedArticles = $page->selectedArticles()->pages(',');
foreach($selectedArticles as $article) : 
  // html
endforeach;