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: better paths for links #1765

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/docs/site/docs/_fragments/_api_list.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- [Query API](/developers/apis/query-api/) enable basic operations using only query parameters
- [Blueprints API](/blueprints/intro.md) give you a great degree of control with a simple JSON file
- [JavaScript API](/developers/apis/javascript-api/) give you full control via a JavaScript client from an npm package
- [Query API](/developers/apis/query-api) enable basic operations using only query parameters
- [Blueprints API](/blueprints) give you a great degree of control with a simple JSON file
- [JavaScript API](/developers/apis/javascript-api) give you full control via a JavaScript client from an npm package
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

The site at https://playground.wordpress.net is there to support the community, but there are no guarantees it will continue to work if the traffic grows significantly.

If you need certain availability, you should [host your own WordPress Playground](../developers/23-architecture/18-host-your-own-playground.md).
If you need certain availability, you should [host your own WordPress Playground](/developers/architecture/host-your-own-playground).
6 changes: 3 additions & 3 deletions packages/docs/site/docs/blueprints/01-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ Blueprints are JSON files for setting up your very own WordPress Playground inst

There are three ways to use Blueprints:

- [Paste a Blueprint into the URL "fragment" on WordPress Playground website](./02-using-blueprints.md#url-fragment).
- [Use them with the JavaScript API](./02-using-blueprints.md#javascript-api).
- [Reference a blueprint JSON file via QueryParam blueprint-url](../developers/apis/query-api/)
- [Paste a Blueprint into the URL "fragment" on WordPress Playground website](/blueprints/using-blueprints#url-fragment).
- [Use them with the JavaScript API](/blueprints/using-blueprints#javascript-api).
- [Reference a blueprint JSON file via QueryParam blueprint-url](/developers/apis/query-api/)

## What problems are solved by Blueprints?

Expand Down
1 change: 1 addition & 0 deletions packages/docs/site/docs/blueprints/02-using-blueprints.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Using Blueprints
slug: /blueprints/using-blueprints
---

# Using Blueprints
Expand Down
3 changes: 2 additions & 1 deletion packages/docs/site/docs/blueprints/03-data-format.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebar_position: 1
title: Blueprint data Format
slug: /blueprints/data-format
---

# Blueprint data format
Expand Down Expand Up @@ -109,7 +110,7 @@ You can preload extra libraries into the Playground instance. The following libr

## Steps

Arguably the most powerful property, `steps` allows you to configure the Playground instance with preinstalled themes, plugins, demo content, and more. The following example logs the user in with a dedicated username and password. It then installs and activates the Gutenberg plugin. [Learn more about steps](./05-steps.md).
Arguably the most powerful property, `steps` allows you to configure the Playground instance with preinstalled themes, plugins, demo content, and more. The following example logs the user in with a dedicated username and password. It then installs and activates the Gutenberg plugin. [Learn more about steps](/blueprints/steps).

```js
{
Expand Down
7 changes: 4 additions & 3 deletions packages/docs/site/docs/blueprints/05-steps.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
sidebar_position: 3
slug: /blueprints/steps
---

# Steps
Expand All @@ -22,11 +23,11 @@ Each step is an object that contains a `step` property that specifies the type o

The following step-related topics are addressed on dedicated pages included in this section:

- [Resources References](./04-resources.md) allow you use external files in Blueprints.
- [Resources References](/blueprints/steps/resources) allow you use external files in Blueprints.

- Some steps have a shorthand version. Check the [Shorthands](./05-steps-shorthands.md) section for more information about them.
- Some steps have a shorthand version. Check the [Shorthands](/blueprints/steps/shorthands) section for more information about them.

- For each step listed below, you'll find both a "Blueprint API" and a "Function API". Refer to the [API Consistency](./07-json-api-and-function-api.md) page for further details.
- For each step listed below, you'll find both a "Blueprint API" and a "Function API". Refer to the [API Consistency](/blueprints/steps/api-consistency) page for further details.

:::tip
The [WordPress Playground Step Library](https://akirk.github.io/playground-step-library/#) tool provides a visual interface to drag or click the steps to create a blueprint for WordPress Playground. You can also [create your own steps](https://github.com/akirk/playground-step-library/#contributing)!
Expand Down
1 change: 1 addition & 0 deletions packages/docs/site/docs/blueprints/08-examples.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebar_position: 8
title: Examples
slug: /blueprints/examples
---

import BlueprintExample from '@site/src/components/Blueprints/BlueprintExample.mdx';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Troubleshoot and debug
slug: /blueprints/troubleshoot-and-debug
---

# Troubleshoot and debug Blueprints
Expand All @@ -23,13 +24,13 @@ The editor is under development and the embedded Playground sometimes fails to l

## Check for the Filesystem and Database

Some blueprint steps (such as [`writeFile`](/wordpress-playground/blueprints/steps#WriteFileStep)) alter the internal Filesystem structure of the Playground instance and some others (such as [`runSql`](/wordpress-playground/blueprints/steps#runSql)) alter the internal WordPress database.
Some blueprint steps (such as [`writeFile`](/blueprints/steps#WriteFileStep)) alter the internal Filesystem structure of the Playground instance and some others (such as [`runSql`](/blueprints/steps#runSql)) alter the internal WordPress database.

To check the final internal filesytem structure and database (after the blueprint steps have been applied) we can leverage some WordPress plugins that provide a SQL manager and a file explorer such as [`SQL Buddy`](https://wordpress.org/plugins/sql-buddy/) and [`WPide`](https://wordpress.org/plugins/wpide/) (you can see them in action from https://playground.wordpress.net/?plugin=sql-buddy&plugin=wpide)

:::tip

There are a bunch of methods we can launch from the console of any WordPress Playground instance to inspect the internals of that instance. They're exposed as part of `window.playground` object (see [Developers > JavaScript API > Debugging and testing](../developers/apis/javascript-api/#debugging-and-testing)). Some examples:
There are a bunch of methods we can launch from the console of any WordPress Playground instance to inspect the internals of that instance. They're exposed as part of `window.playground` object (see [Developers > JavaScript API > Debugging and testing](/developers/apis/javascript-api/#debugging-and-testing)). Some examples:

```
> await playground.isDir("/wordpress/wp-content/plugins")
Expand All @@ -38,7 +39,7 @@ true
(3) ['hello.php', 'index.php', 'WordPress-Importer-master']
```

Full list of methods we can use is available [here](/wordpress-playground/api/client/interface/PlaygroundClient)
Full list of methods we can use is available [here](/api/client/interface/PlaygroundClient)

:::

Expand All @@ -58,12 +59,12 @@ The developer tools window allows you to inspect network requests, view console

## Log your own error messages

You can `error_log` your own error messages through [`runPHP` step](./steps#RunPHPStep) (see [blueprint example](https://github.com/wordpress/blueprints/blob/trunk/blueprints/reset-data-and-import-content/blueprint.json) and [live demo](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/reset-data-and-import-content/blueprint.json)) and check them from the ["View Logs" option](../main/web-instance.md#playground-options-menu) or from the browser's console.
You can `error_log` your own error messages through [`runPHP` step](/blueprints/steps#RunPHPStep) (see [blueprint example](https://github.com/wordpress/blueprints/blob/trunk/blueprints/reset-data-and-import-content/blueprint.json) and [live demo](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/reset-data-and-import-content/blueprint.json)) and check them from the ["View Logs" option](/web-instance#playground-options-menu) or from the browser's console.

![Log errors snapshot](./_assets/log-errors.png)

:::info
When you download your Playground instance as a `zip` through the ["Download as zip" option](../main/web-instance.md#playground-options-menu) you'll also download the `debug.log` file containing all the logs from your Playground instance.
When you download your Playground instance as a `zip` through the ["Download as zip" option](/web-instance#playground-options-menu) you'll also download the `debug.log` file containing all the logs from your Playground instance.
:::

## Ask for help
Expand Down
22 changes: 11 additions & 11 deletions packages/docs/site/docs/blueprints/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ Blueprints are JSON files for setting up your very own WordPress Playground inst

<p class="docs-hubs">The WordPress Playground documentation is distributed across four separate hubs (subsites):</p>

- [**Documentation**](/wordpress-playground/) – Introduction to WP Playground, starter guides and your entry point to WP Playground Docs.
- 👉 [**Blueprints**](/wordpress-playground/blueprints) (you're here) – Blueprints are JSON files for setting up your WordPress Playground instance. Learn about their possibilities from this Blueprints docs hub.
- [**Developers**](/wordpress-playground/developers) – WordPress Playground was created as a programmable tool. Discover all the things you can do with it from your code in the Developers docs hub.
- [**API Reference**](/wordpress-playground/api) – All the APIs exposed by WordPress Playground
- [**Documentation**](/) – Introduction to WP Playground, starter guides and your entry point to WP Playground Docs.
- 👉 [**Blueprints**](/blueprints) (you're here) – Blueprints are JSON files for setting up your WordPress Playground instance. Learn about their possibilities from this Blueprints docs hub.
- [**Developers**](/developers) – WordPress Playground was created as a programmable tool. Discover all the things you can do with it from your code in the Developers docs hub.
- [**API Reference**](/api) – All the APIs exposed by WordPress Playground

## Navigating the Blueprints documentation hub

This docs hub is focused on Blueprints info and is divided into the following major sections:

- [Getting started with Blueprints](./01-index.md): Quick Start Guide to setting up a WordPress Playground instance using Blueprint JSON files.
- [Getting started with Blueprints](/blueprints/getting-started): Quick Start Guide to setting up a WordPress Playground instance using Blueprint JSON files.

- [Tutorial - Blueprints 101](./tutorial/index.md) - Blueprints API crash course. The tutorial will guide you through the complete process of creating a blueprint that loads a theme and plugin (among other things).
- [Tutorial - Blueprints 101](/blueprints/tutorial) - Blueprints API crash course. The tutorial will guide you through the complete process of creating a blueprint that loads a theme and plugin (among other things).

- [Blueprint data Format](./03-data-format.md): Blueprint JSON files define your Playground instance with various properties. This section highlights the key properties you need to know.
- [Blueprint data Format](/blueprints/data-format): Blueprint JSON files define your Playground instance with various properties. This section highlights the key properties you need to know.

- [Using Blueprints](./02-using-blueprints.md): Learn in this section different ways to use Blueprints.
- [Using Blueprints](/blueprints/using-blueprints): Learn in this section different ways to use Blueprints.

- [Steps](./05-steps.md): API Reference of all the available steps that can be set in a blueprint to run tasks such as login, plugin/theme activation, file operations, and more.
- [Steps](/blueprints/steps): API Reference of all the available steps that can be set in a blueprint to run tasks such as login, plugin/theme activation, file operations, and more.

- [Examples](./08-examples.md): Compilation of Blueprint examples for various WordPress Playground setups, including installing themes/plugins, running PHP code, enabling features, and loading specific WordPress versions.
- [Examples](/blueprints/examples): Compilation of Blueprint examples for various WordPress Playground setups, including installing themes/plugins, running PHP code, enabling features, and loading specific WordPress versions.

- [Troubleshoot and debug Blueprints](./09-troubleshoot-and-debug-blueprints.md): Tips and tools for troubleshooting and debugging Blueprints.
- [Troubleshoot and debug Blueprints](/blueprints/troubleshoot-and-debug): Tips and tools for troubleshooting and debugging Blueprints.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Visit these links to learn more about the (endless) possibilities of Blueprints:

- [Introduction to WordPress Playground](https://developer.wordpress.org/news/2024/04/05/introduction-to-playground-running-wordpress-in-the-browser/)
- Embed a pre-configured WordPress site in your website using the [WordPress Playground Block](https://wordpress.org/plugins/interactive-code-block/).
- [Blueprints examples](../08-examples.md)
- [Demos and apps built with Blueprints](../../main/resources.md#apps-built-with-wordpress-playground)
- [Blueprints examples](/blueprints/examples)
- [Demos and apps built with Blueprints](/resources#apps-built-with-wordpress-playground)

:::
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Here's what it looks like in VS Code:

## 2. Set the site title to "My first Blueprint"

Blueprints consist of a series of [steps](../steps) that define how to build a WordPress site. Before you write the first step, declare an empty list of steps:
Blueprints consist of a series of [steps](/blueprints/steps) that define how to build a WordPress site. Before you write the first step, declare an empty list of steps:

```json
{
Expand Down Expand Up @@ -71,7 +71,7 @@ WordPress stores the site title in the `blogname` option. Add your first step an

[<kbd> &nbsp; Run Blueprint &nbsp; </kbd>](https://playground.wordpress.net/#https://playground.wordpress.net/#eyIkc2NoZW1hIjoiaHR0cHM6Ly9wbGF5Z3JvdW5kLndvcmRwcmVzcy5uZXQvYmx1ZXByaW50LXNjaGVtYS5qc29uIiwic3RlcHMiOlt7InN0ZXAiOiJzZXRTaXRlT3B0aW9ucyIsIm9wdGlvbnMiOnsiYmxvZ25hbWUiOiJNeSBmaXJzdCBCbHVlcHJpbnQifX1dfQ==)

The [`setSiteOptions` step](../steps#SetSiteOptionsStep) specifies the site options in the WordPress database. The `options` object contains the key-value pairs to set. In this case, you changed the value of the `blogname` key to "My first Blueprint". You can read more about all available steps in the [Blueprint Steps API Reference](../steps).
The [`setSiteOptions` step](/blueprints/steps#SetSiteOptionsStep) specifies the site options in the WordPress database. The `options` object contains the key-value pairs to set. In this case, you changed the value of the `blogname` key to "My first Blueprint". You can read more about all available steps in the [Blueprint Steps API Reference](/blueprints/steps).

### Shorthands

Expand All @@ -90,7 +90,7 @@ The shorthand syntax and the step syntax correspond with each other. Every step

## 3. Install the _Adventurer_ theme

Adventurer is an open-source theme [available in the WordPress theme directory](https://wordpress.org/themes/adventurer/). Let's install it using the [`installTheme` step](../steps#InstallThemeStep):
Adventurer is an open-source theme [available in the WordPress theme directory](https://wordpress.org/themes/adventurer/). Let's install it using the [`installTheme` step](/blueprints/steps#InstallThemeStep):

```json
{
Expand Down Expand Up @@ -135,7 +135,7 @@ Learn more about the supported resources in the [Blueprint Resources API Referen

## 4. Install the _Hello Dolly_ plugin

A classic WordPress plugin that displays random lyrics from the song "Hello, Dolly!" in the admin dashboard. Let's install it using the [`installPlugin` step](../steps#InstallPluginStep):
A classic WordPress plugin that displays random lyrics from the song "Hello, Dolly!" in the admin dashboard. Let's install it using the [`installPlugin` step](/blueprints/steps#InstallPluginStep):

```json
{
Expand Down Expand Up @@ -187,11 +187,11 @@ function my_custom_plugin() {
add_action('admin_notices', 'my_custom_plugin');
```

You can use the [installPlugin](../steps#InstallPluginStep), but that requires creating a ZIP file. Let's start with something different to see if the plugin works:
You can use the [installPlugin](/blueprints/steps#InstallPluginStep), but that requires creating a ZIP file. Let's start with something different to see if the plugin works:

1. Create a `wp-content/plugins/hello-from-the-dashboard` directory using the [`mkdir` step](../steps#MkdirStep).
2. Write a `plugin.php` file using the [`writeFile` step](../steps#WriteFileStep).
3. Activate the plugin using the [`activatePlugin` step](../steps#ActivatePluginStep).
1. Create a `wp-content/plugins/hello-from-the-dashboard` directory using the [`mkdir` step](/blueprints/steps#MkdirStep).
2. Write a `plugin.php` file using the [`writeFile` step](/blueprints/steps#WriteFileStep).
3. Activate the plugin using the [`activatePlugin` step](/blueprints/steps#ActivatePluginStep).

Here's what that looks like in a Blueprint:

Expand All @@ -217,7 +217,7 @@ Here's what that looks like in a Blueprint:
}
```

The last thing to do is log the user in as an admin. You can do that with a shorthand of the [`login` step](../steps#LoginStep):
The last thing to do is log the user in as an admin. You can do that with a shorthand of the [`login` step](/blueprints/steps#LoginStep):

```json
{
Expand Down Expand Up @@ -277,7 +277,7 @@ That's what it looks like when you navigate to the dashboard:

### Create a plugin and zip it

Encoding PHP files as `JSON` can be useful for quick testing, but it's inconvenient and difficult to read. Instead, create a file with the plugin code, compress it, and use the `ZIP` file as the `resource` in the [`installPlugin` step](../steps#InstallPluginStep) to install it (the path in the `URL` should match the one in your GitHub repository):
Encoding PHP files as `JSON` can be useful for quick testing, but it's inconvenient and difficult to read. Instead, create a file with the plugin code, compress it, and use the `ZIP` file as the `resource` in the [`installPlugin` step](/blueprints/steps#InstallPluginStep) to install it (the path in the `URL` should match the one in your GitHub repository):

```json
{
Expand Down Expand Up @@ -360,7 +360,7 @@ foreach ($posts as $post) {
}
```

To run that code during the site setup, use the [`runPHP` step](../steps#RunPHPStep):
To run that code during the site setup, use the [`runPHP` step](/blueprints/steps#RunPHPStep):

```json
{
Expand All @@ -377,7 +377,7 @@ To run that code during the site setup, use the [`runPHP` step](../steps#RunPHPS

### Import the new content

Let's use the [`importWxr` step](../steps#ImportWXRStep) to import a WordPress export (`WXR`) file that helps test WordPress themes. The file is available in the [WordPress/theme-test-data](https://github.com/WordPress/theme-test-data) repository, and you can access it via its `raw.githubusercontent.com` address: [https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml](https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml).
Let's use the [`importWxr` step](/blueprints/steps#ImportWXRStep) to import a WordPress export (`WXR`) file that helps test WordPress themes. The file is available in the [WordPress/theme-test-data](https://github.com/WordPress/theme-test-data) repository, and you can access it via its `raw.githubusercontent.com` address: [https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml](https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml).

Here's what the final Blueprint looks like:

Expand Down
Loading
Loading