Closed eduardoformiga closed 4 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
What's the purpose of this pull request?
This PR aims to add multiple-page templates for friendly URLs that are added using rewrites. It also add some tests.
The documentation is in this PR:
How it works?
Using Rewrites with PLP template
FastStore enables the use of rewrites from Next.js to create a custom route. It's possible to enable the multiple-page template feature for the custom route as well by adding your rewrites function into the
faststore.config.js
file as the Next.js doc suggests:or
In the example above, the new
source
route/my-office
will be rewritten to the existingdestination
route/office
, using the/office
template without changing the URL. In that way, you can use the existingdestination
route/office
to map this template in the hCMS.From the version of this PR, it's also possible to use the
source
route in the hCMS to map the template.How to test it?
vendemo
account in the cms config file (keeping thestoreframework
in the faststore.config.js just to keep the catalog). https://github.com/vtex/faststore/blob/37bca87b4f08002bcb74b3734e9b273d8560bee2/packages/core/src/server/cms/index.ts#L45/test/my-office
or/office
in the input from the settings tabyarn dev
/test/my-office
or/office
) should show the new template.References
PLP doc