Skip to content

IndexField

Daniel Petutschnigg edited this page Sep 26, 2021 · 19 revisions

Table of Contents

Description

The IndexField provides an easy way to link to childpages of a slug or to fetch data of childpages and build cards on any page in your project. It is not possible to edit the text on these components for that job please look at our StreamField.

Code

import {fields, JaenTemplate} from '@snek-at/jaen-pages'

const HomePage: JaenTemplate = () => {
  return (
    <fields.IndexField
      fixedSlug={'pageId'}
      onRender={(page) => (
        return(
	  [...]
	)
    />
  )
}

HomePage.TemplateName = "HomePage"

export default HomePage

Parameters

Property Type Required Description
fixedSlug string no If fixedSlug is not specified the IndexField will take the children of the current page. It allows you to decide which pages children are used.
onRender function yes onRender allows you to build React-Components of any kind.

onRender

Property Type Description
page object The page property gives you the page data including childpages in the form of an object

Code Sandbox

WIP

Clone this wiki locally