Resolve "[ENG][I18N] Remove the hreflang for a couple solutions and get started pages"
Note
The first version of this MR became deprecated so I created this new one, this is the link for the old version.
Problem
Some pages on the /solutions
and /get-started
category have hreflang problems.
What is happening with this scenario is that those pages use the same template for many pages, some are localized and others are not.
For example, the solutions/security-compliance/ page is localized so the error does not occur, but the solutions/continuous-integration/ gets the hreflang error.
This is happening because if we pass the i18n
param to the meta.ts
function the template will be automatically read as "localized", even if some pages are still only in english.
Solutions
- I created a script
find-not-localized.js
using glob to search through the German content folder of/get-started
and/solutions
, all files found there dynamically create another filelocalized-pages.ts
with the list of localized pages for those two routes. - Added the
localized-pages.ts
togit-ignore
file since it's dynamically created and its content is relevant only when building the page - Use the list from the
localized-pages.ts
on themeta.ts
file to validate if the current page is localized AND uses the 'get-started' or 'solutions' template - If the page is not localized then it will receive only the english hreflang
Review App for ENG Home page
Review App for German Home page
Review App for German only page
Review App for localized solutions page
Review App for not localized solutions page
Review App for localized get-started page
Review App for not localized get-started page
Closes #2879 (closed)