there are different ways how you could achieve that:
- You can use a multi options field to select stories which you would like to have in the slider or newsfeed:
The uuids of the stories which are being referenced with the multi options field are being added to the JSON of the example1 which looks like this:
Those stories can be resolved and inserted instead of having only the uuids by using the resolve_relations parameter and adding the components name + the field name:
With this solution you can access the content of the referenced stories and eventually also images which then can be used to create thumbnails using our image service.
In the case that you’re using the new asset field you can add Alt, Title/Caption and Copyright information directly to the asset:
The image links delivered in the asset field type look like the following example:
Which can be changed ( https://www.storyblok.com/docs/image-service#code-examples ) into https://img2.storyblok.com/150x0/f/89533/3024x4032/a0dfe4b5d3/pexels-alex-kozlov-5587738.jpg or with blur https://img2.storyblok.com/150x0/filters:blur(3)/f/89533/3024x4032/a0dfe4b5d3/pexels-alex-kozlov-5587738.jpg
You can find more information about the available filters here:
- You can create a blocks field which contains instances of a component which holds the link to an image, the name or a description and a link to a story:
Observation: The component in the example shows you a preview of the fields created inside of the component which can be achieved with the schema review feature https://www.storyblok.com/docs/schema-configuration#topic-preview
You can take a look at the configuration of the example2 story:
What can you do with the linked story? Exactly! You can also resolve it:
You can choose between
which will give you the link object of the linked story or
which will equally to
will give you the complete story object from which you can then take any information inside of your code.
- The possibly most flexible way to implement a news feed which is being shown below your articles is to use a logic which is being controlled from a story or a component that doesn’t contain any content but information how many stories to show in the news feed or slider. This can be achieved by linking a story which can then be reused including its settings. The linking can be done like explained in 1. with the option field where you can choose a single option field instead of a multi option field.
The configuration could look like in this story:
The content part contains the following data:
The information can be used to construct a request like the following:
This request will give you the two newest stories of the category “Web Design” which is also a story and referenced using a multi option field as you can also pass a list of UUIDs you can also find article which belong to more than only one category.
The explanations and more examples of the different parameters can be found here in the documentation: