When creating a project using Slice machine, fields inside slices are referenced as easily as you saw in the code snippet that you shared. Are you using Next or Nuxt?
Slice Machine simplifies the way data is retrieved and does the hard work for you; connecting your repository endpoint to your project, as well as the queries made to retrieve each document so you only have to worry about creating content and templating it when working with the Slice Zone.
slice.primary is just calling entering the response of a slice. After that you just need to call all the fields inside of it. So take this example. I have a Slice called HeroText and inside of it it has
The easiest way to create Slices and Components with Slice machine is by using the create slice command, read the article (this one is for nuxt): Creating your own Slices & Components
I think I’ve not been totally clear.
So let’s say I have a content_type for Posts which itself includes it’s own title, tagline and author.
I want to access fields from the parent that’s calling the slice from within my slice, how do I reference them?
Eg. What do I need to do in the posts file to send an object across to the slice… and within the slice how do I reference the parents paramaters, preferably accessing them in the slice html as something like doc.title and doc.author.