-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(dev/plugin): add localization to static pages #430
Conversation
@mkilpatrick One thing of note that I ran into when testing: If we have a static page with more than one locale, but a constant
In dev, it creates two pages: Is this something we want to address as a part of this item, or something that we should make an item for? As of now, I'm not sure whether we should expect one of the locales to be overwritten, or if it should have two pages as we do in dev. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This is a good question. Could you bring it up in the original Slack thread discussion? Perhaps we should instead throw an error that you've defined multiple locales but only one output path/html file can be created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
This PR adds localization to static pages and adds an interface for
StaticTemplateConfig
. Localization can now be specified for static pages by including the following in theTemplateConfig
.This config is included in the
templates.json
/features.json
to be consumed by Spruce as:Additionally, it was found that since static pages no longer have a single
staticURL
perfeatureName
, thelocalDataManifest
had to be refactored. This is because static pages now accept adocument
in theirgetPath
function, meaning that when static pages may have different URLs depending on the document if the path uses thedocument
'slocale
.Furthermore, it was found that when running
yext pages render
to generate pages, static pages with a constantgetPath
return value multiple locales would only generate one static page. To deal with this behavior, pages will now throw an error when users have multiple static pages with identical paths.J=SUMO-5451
TEST=manual
It was tested that you can specify
locale
s in theTemplateConfig
for static pages, and that they property show up in thetemplates.json
. It was also tested that whenyext pages generate-test-data
is called, it generates a document for each locale specified in a static page.