feat(topics): Improve the hreflang generation
Build Variables:
-
Use Contentful Preview API
Step 1: What is changing in this MR?
- Update the Topics Service to return both the payload and the available languages of a page
- Implement the combination of
middleware
,validate
, andasyncData
component methods.- The
middleware
method fetches the data as it is the first in the lifecycle to run. It is done in this method to persist the data in the context and avoid calling the same data again in thevalidate
andasyncData
methods - The
validate
method verifies the available languages of a page, if a language is unavailable, the route won't be generated during the routes generation. - The
asyncData
was refactored to read the data from the context and execute the component's logic.
- The
- Create a new
localizedMeta
function that filters the languages that are not available for a page to avoid having 404 localized pages in the metadata
Production | Review app |
---|---|
https://about.gitlab.com/topics/devops | https://3833-duplicates-and-incorrect-hreflang-implementation-it-it-pt.about.gitlab-review.app/topics/devops |
Related #3833 (closed)
Edited by John Arias Castillo