Skip to content

Commit b4a77cf

Browse files
committed
add readme
1 parent 3e3cd0e commit b4a77cf

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Astro Template HIerarchy and Data fetching w/URQL Example
2+
3+
In this example we show how to implement the WP Template Hierarchy in Astro for use with a Headless WordPress backend using WPGraphQL. We use URQL for all routing and fetching page content.
4+
5+
## Getting Started
6+
7+
> [!IMPORTANT]
8+
> Docker Desktop needs to be installed to run WordPress locally.
9+
10+
1. Run `npm run example:setup` to install dependencies and configure the local WP server.
11+
2. Run `npm run example:start` to start the WP server and Astro development server.
12+
13+
> [!NOTE]
14+
> When you kill the long running process this will not shutdown the local WP instance, only Astro. You must run `npm run example:stop` to kill the local WP server.
15+
16+
## Trouble Shooting
17+
18+
To reset the WP server and re-run setup you can run `npm run example:prune` and confirm "Yes" at any prompts.

examples/astro/template-hierarchy-data-fetching-urql/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"example:start": "pnpm run wp:start && npm run app:dev",
88
"example:setup": "npm run example:bootstrap && npm run wp:start && npm run wp:db:import && npm run example:stop",
99
"example:stop": "npm run wp:stop",
10-
"example:prune": "wp-env destroy && npm run example:setup && npm run example:start",
10+
"example:prune": "npm run wp:destroy && npm run example:setup && npm run example:start",
1111
"app:dev": "cd example-app && pwd && npm run dev && cd ..",
1212
"app:install": "cd ./example-app && npm install && cd ..",
1313
"wp:start": "wp-env start",

0 commit comments

Comments
 (0)