Skip to content

Commit 1c7d735

Browse files
authored
[Doc] Prerender.io configuration docs (#5)
* Added configuration docs for the prerender.io support * Typo fixes
1 parent b6a4a50 commit 1c7d735

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

README.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ The Magento 2 UPWARD connector is configured in the admin area under:
1515

1616
**Stores > Configuration > General > Web > UPWARD PWA Configuration**.
1717

18-
### UPWARD Config File
18+
### General configuration
19+
20+
These are the configurations for the UPWARD process itself.
21+
#### UPWARD Config File
1922

2023
This configuration is the location of the UPWARD configuration file for the UPWARD-PHP server.
2124

2225
_Use the absolute path on the server for the value of this configuration._
2326

2427
Example: `/app/node_modules/@magento/venia-concept/dist/upward.yml`
2528

26-
### Front Name Allowlist
29+
#### Front Name Allowlist
2730

2831
This configuration allows you to specify a line-separated list of routes to forward to the default Magento theme.
2932

@@ -36,6 +39,48 @@ privacy-policy-cookie-restriction-mode
3639

3740
With this example, when a visitor navigates to either `<Magento store URL>/contact` or `<Magento store URL>/privacy-policy-cookie-restriction-mode`, they will land on a page rendered by Magento instead of the storefront application.
3841

42+
### Prerender.io Configuration
43+
44+
[Prerender.io][] support in the upward-connector module allows your site to send prerendered static html to search bots.
45+
46+
A middleware layer checks each request to see if it comes from a crawler and if allowed, sends it to the prerender service.
47+
These configuration entries let you configure which pages to send to Prerender.io to serve the static HTML versions of that page.
48+
If a page is not configured for prerendering, the request continues using the normal server routes.
49+
50+
| Configuration | Description | Example |
51+
| -------------------------------- | ---------------------------------------------------------------------------------------------- | ----------------------------- |
52+
| Enable Prerender For Search Bots | This enables prerender functionality for this store view. | |
53+
| Prerender URL | Url of the prerender service. | https://service.prerender.io/ |
54+
| Prerender.io Token | Token to use for the prenderer.io hosted service | |
55+
| Crawler User Agents | Line break separated list of keywords to detect the crawler in the user-agent request header | |
56+
| Blocked List | Resources that will not be sent for prerendering. Use `*` as a wildcard character. | `.js` `*/cart` |
57+
| Allowed List | Explicitly allowed resources to be sent for prerendering. If empty, all resources are allowed. | |
58+
59+
#### Testing prerendered pages
60+
61+
To see how a crawler sees a prerendered page, set your browser's User Agent to `Googlebot` and visit your URL.
62+
You can also run this on the command line and change the sample URL to your storefront's URL:
63+
64+
``` sh
65+
curl -A Googlebot https://www.example.com/ > page.html
66+
```
67+
68+
To configure prerender locally for testing purposes, see https://docs.prerender.io/test-it/.
69+
70+
#### Troubleshooting partial rendered pages
71+
72+
There is no way to tell when a PWA page fully loads.
73+
For prerendering it is possible to force prerender to wait for a predefined timeout before setting the `window.prerenderReady` flag.
74+
75+
Add the following to the runtime script:
76+
77+
``` js
78+
window.prerenderReady = false;
79+
setTimeout(function () { window.prerenderReady = true }, 1000 * 15)
80+
```
81+
82+
For more information, see https://docs.prerender.io/test-it/.
83+
3984
## Service Worker Note
4085

4186
Avoid sharing the same hostname between your PWA Studio storefront and the Magento 2 admin backend.
@@ -44,3 +89,4 @@ If you cannot avoid sharing the hostname, access one service at a time or use a
4489

4590
[upward-php]: https://github.com/magento/upward-php
4691
[magento cloud deployment]: http://pwastudio.io/tutorials/cloud-deploy/
92+
[prerender.io]: https://docs.prerender.io/

0 commit comments

Comments
 (0)