Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Fetch hierarchical posts #214

Closed
rodrigo-arias opened this issue Feb 18, 2021 · 1 comment
Closed

Fetch hierarchical posts #214

rodrigo-arias opened this issue Feb 18, 2021 · 1 comment

Comments

@rodrigo-arias
Copy link

rodrigo-arias commented Feb 18, 2021

Hi guys, I'm using your repo as a reference for a WordPress and Next implementation. Thank you for all the work you are doing, it is a great contribution.

Description
I am having some issues fetching hierarchical posts. You are fetching posts by ID from the URI if it is hierarchical, from the SLUG if it is not here.

And then you are splitting the path here to return it in the getStaticPaths function.

All of that makes perfect sense. But I'm seeing that if you have a URI for example people/name, you return the path as an array ['people', 'name'] and then in the params attribute of getStaticProps here, it receives only slug: ['name']

For some reason in the background I am losing one of the parameters.

Notes
I found some discussions that could be related, I add the references in case they are useful:
vercel/next.js#14150
vercel/next.js#11272
vercel/next.js#11738

I would like to know if it was something that you were also experiencing or maybe I am doing something wrong. Thanks

@gregrickaby
Copy link
Contributor

gregrickaby commented Feb 18, 2021

@rodrigo-arias Hey thank you so much for checking out the starter and submitting feedback.

I think I'm following along with your issue so I tried to replicated it:

  1. I created a new page "Careers"
  2. Under Page --> Attributes, I set the Parent --> About
  3. I published Careers
  4. I added it to the Primary menu
  5. I clicked on "Careers" from the menu dropdown on the frontend

It displays for me: https://nextjs-wordpress-starter-develop.vercel.app/about/careers

Could you provide any more details about how your have your site configured? I'll do my best to help out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants