Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Example of fetching data for Next.js app router using the fetch API #74

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

colinmurphy
Copy link
Contributor

Not anyway complete yet. Creating draft PR currently for wp-env setup approach

Added scripts for wp-env to setup example fo rnext.js app. Still a bit to sort and added the start of the README.md
…ub.com:wpengine/hwptoolkit into example-data-fetch-nextjs-app-router-fetch-api
Added more posts for pagination. Added more CPT events too. Content generated by Claude.
- Restructured based on merged PRs
- Moved any wp-env assets under wp-env to make it cleaner for a developer
- Updated README.md with install
- Removed uploads directory
- Added agents.json for AI LLMs
@colinmurphy colinmurphy changed the title Initial scaffold of next.js with wp-env setup Example: Fetching data for Next.js app router using the fetch API Mar 10, 2025
Renamed template structure as per #89

Added boilerplate templates with dummy content to be filled.
Added header/footer
Fixed issue with having to flush permalinks once the DB was imported.
Fixed issue with CORS for requests from localhost:3000
Refactord all 3 templates to use the same template components
Added Posts Per Page as a variable in the next config too.
@colinmurphy colinmurphy changed the title Example: Fetching data for Next.js app router using the fetch API docs: Fetching data for Next.js app router using the fetch API Mar 13, 2025
@colinmurphy colinmurphy changed the title docs: Fetching data for Next.js app router using the fetch API docs: Example of fetching data for Next.js app router using the fetch API Mar 13, 2025
@colinmurphy
Copy link
Contributor Author

@josephfusco @theodesp @moonmeister @whoami-pwd @ahuseyn

The current state of this PR is:

Complete

  • WP Env setup (hopefully re-usable for other examples)
  • Homepage
  • Node By URI (Single Page and Post)
  • Blog, Category and Tag Pages (all re-use same templates)
  • Event listings (someway)

What is left to do

  • In general a bit of just testing
  • Event listings should be ordered by custom meta field data and possibly show events descending (real life would be upcoming events but this would eventually be empty)
  • Location taxonomy should be there too
  • Tidying up of the event template
  • The featured image is used 3/4 places. Should be a component
  • Single CPT for Events
  • Blog comment form and mutation
  • Documentation on caching. There is SSG, SSR, ISR
  • Update the README
  • Definitely worth going through wp-env again and making sure commands are all working

Other notes for testing

  1. http://localhost:3000/category/lifestyle is a category with a load more
  2. http://localhost:3000/mental-game-elite-athletes is a post with comments
  3. http://localhost:3000/tag/interior-design is a tag page
  4. http://localhost:3000/category/sport/marathon sub category (for checking title)

Screenshots

Screenshot 2025-03-13 at 21 16 20 Screenshot 2025-03-13 at 21 16 30 Screenshot 2025-03-13 at 21 16 44 Screenshot 2025-03-13 at 21 17 22 Screenshot 2025-03-13 at 21 17 34

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

Successfully merging this pull request may close these issues.

1 participant