Skip to content

Commit c57605b

Browse files
committed
add index, remove tutorials
1 parent d2753c4 commit c57605b

File tree

4 files changed

+143
-19
lines changed

4 files changed

+143
-19
lines changed

docs/plugins/hwp-previews/index.md

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,146 @@ title: "HWP Previews"
33
description: "HWP Previews plugin enables seamless preview functionality for headless WordPress applications, allowing content creators to preview their changes in the frontend application before publishing."
44
---
55

6-
@TODO
6+
## Introduction
7+
8+
**HWP Previews** is a headless preview solution for WordPress that provides fully configurable preview URLs via a settings interface.
9+
10+
This plugin bridges the preview gap in headless WordPress architectures, allowing content creators to preview their changes in the front-end application before publishing.
11+
12+
## Table of Contents
13+
14+
* [Key Features](#key-features)
15+
* [Setup](#setup)
16+
* [Project Structure](#project-structure)
17+
* [Configuration](#configuration)
18+
* [Front-End Integration](#front-end-integration)
19+
* [Using With Faust.js](#using-with-faustjs)
20+
* [Documentation](#documentation)
21+
* [Contributing](#contributing)
22+
23+
## Key Features
24+
25+
### Framework Agnostic
26+
27+
The plugin works with any front-end framework (Next.js, Nuxt, React, Vue, etc.) and data-fetching method (WPGraphQL, REST API, or custom endpoints).
28+
29+
### Per Post Type Configuration
30+
31+
Configure preview behavior independently for each public post type:
32+
33+
* Enable or disable previews
34+
* Define custom URL templates with dynamic parameters
35+
* Choose between iframe or new tab preview modes
36+
* Allow draft posts as parents for hierarchical types
37+
38+
### Dynamic URL Templates
39+
40+
Use placeholder tokens to build context-rich preview URLs:
41+
42+
* `{ID}` - Post ID
43+
* `{author_ID}` - Post author's user ID
44+
* `{status}` - Post status (draft, pending, etc.)
45+
* `{slug}` - Post slug
46+
* `{parent_ID}` - Parent post ID (for hierarchical types)
47+
* `{type}` - Post type slug
48+
* `{template}` - Template filename
49+
50+
### Extensible Architecture
51+
52+
Extend the plugin through WordPress hooks and filters to add custom parameters, modify settings, or integrate with other plugins.
53+
54+
### Faust.js Integration
55+
56+
Automatic integration with Faust.js that pre-configures preview URLs and removes conflicts while maintaining existing workflows.
57+
58+
***
59+
60+
## Setup
61+
62+
Once the plugin is installed and activated, you can configure it under Settings > HWP Previews.
63+
64+
By default, no post types are configured unless you have Faust.js installed, which triggers automatic configuration.
65+
66+
### Quick Start
67+
68+
| Step | Action | Description |
69+
| ---- | ------ | ----------- |
70+
| 1 | Navigate to Settings | Go to **Settings > HWP Previews** in WordPress admin |
71+
| 2 | Choose a post type | Click the tab for the post type (Posts, Pages, etc.) |
72+
| 3 | Enable previews | Check "Enable HWP Previews" |
73+
| 4 | Set preview URL | Enter your front-end preview endpoint with parameters |
74+
| 5 | Save and test | Save changes and click Preview on any post |
75+
76+
### Basic Configuration
77+
78+
For each public post type, you can configure:
79+
80+
* **Enable HWP Previews**: Master switch to enable preview functionality for the post type
81+
* **Preview URL Template**: The URL template with dynamic parameters that redirects to your front-end
82+
* **Load Previews in Iframe**: Display preview within the WordPress editor or open in a new tab
83+
* **Allow All Statuses as Parent**: (Hierarchical types only) Allow draft/pending posts as parents
84+
85+
![Basic Configuration](how-to/configure-previews/hwp-previews-post-settings.png)
86+
87+
> [!NOTE]
88+
> Settings are cached for performance. Changes may require clearing your object cache.
89+
90+
## Project Structure
91+
92+
```text
93+
hwp-previews/
94+
├── src/ # Main plugin source code
95+
│ ├── Admin/ # Admin settings, menu, and settings page logic
96+
│ │ └── Settings/ # Settings fields and form manager
97+
│ ├── Hooks/ # WordPress hooks and filters
98+
│ ├── Integration/ # Framework integrations (Faust.js)
99+
│ ├── Preview/ # Preview URL resolver, parameters, and services
100+
│ ├── Plugin.php # Main plugin class (entry point)
101+
│ └── Autoloader.php # PSR-4 autoloader
102+
├── examples/ # Example front-end integrations
103+
│ ├── hwp-preview-wpgraphql/ # Next.js + WPGraphQL example
104+
│ └── hwp-preview-rest/ # Next.js + REST API example
105+
├── tests/ # Test suites
106+
│ ├── wpunit/ # WPBrowser/Codeception unit tests
107+
└─ └── e2e/ # End-to-end tests
108+
```
109+
110+
***
111+
112+
## Front-End Integration
113+
114+
HWP Previews is framework and API agnostic. You can integrate it with any front-end application and data-fetching method (WPGraphQL, REST API, or custom endpoints).
115+
116+
### Example Implementations
117+
118+
We provide working examples in the `examples/` directory:
119+
120+
* **[hwp-preview-wpgraphql](https://github.com/wpengine/hwptoolkit/tree/main/plugins/hwp-previews/examples/hwp-preview-wpgraphql)**: Next.js with WPGraphQL using Draft Mode
121+
* **[hwp-preview-rest](https://github.com/wpengine/hwptoolkit/tree/main/plugins/hwp-previews/examples/hwp-preview-rest)**: Next.js App Router with REST API
122+
123+
### Framework-Specific Preview Guides
124+
125+
To implement previews from scratch, refer to your framework's documentation:
126+
127+
* [Next.js Draft Mode (Pages Router)](https://nextjs.org/docs/pages/guides/draft-mode)
128+
* [Next.js Draft Mode (App Router)](https://nextjs.org/docs/app/guides/draft-mode)
129+
* [Nuxt usePreviewMode](https://nuxt.com/docs/api/composables/use-preview-mode)
130+
131+
## Using With Faust.js
132+
133+
HWP Previews automatically integrates with [Faust.js](https://faustjs.org/) when both plugins are active. See the [Integrate with Faust.js](how-to/integrate-with-faust/index.md) guide for details.
134+
135+
## Documentation
136+
137+
### How-to guides
138+
139+
* [Configure Previews](how-to/configure-previews/index.md)
140+
* [Integrate with Faust.js](how-to/integrate-with-faust/index.md)
141+
142+
### Explanation
143+
144+
* [Core Concepts](explanation/core-concepts/index.md)
145+
146+
## Contributing
147+
148+
If you feel like something is missing or you want to add documentation, we encourage you to contribute! Please check out our [Contributing Guide](https://github.com/wpengine/hwptoolkit/blob/main/CONTRIBUTING.md) for more details.

docs/plugins/hwp-previews/tutorial/astro/index.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/plugins/hwp-previews/tutorial/learn-previews/index.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/plugins/hwp-previews/tutorial/rest/index.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)