GrappleGQL / gatsby-source-wagtail

Plugin for sourcing Gatsby data from Wagtail CMS
17 stars 12 forks source link

Fix template example in README #20

Closed tbrlpld closed 3 years ago

tbrlpld commented 4 years ago

Before, the template example was defining to extract the page data with const page = data.wagtail. This leads to the following use of {page.title} having the value undefined.

This issue is caused by a missing level in the returned data. The page data is not available at data.wagtail
but at data.wagtail.page.

The template example is updated and should display the page title as expected in an h1 tag.

tbrlpld commented 3 years ago

Whoops. Guess I did not read the template quite right. It uses the attribute extraction syntax const { page } = data.wagtail which should correctly extract the attribute data.wagtail.page into the variable page.

Sorry, my bad 😓