commercetools / commercetools-docs-kit

Tools and components for developing Documentation websites 🛠
https://docs-kit.commercetools.vercel.app
MIT License
18 stars 5 forks source link

Incorrect page title in static pregenerate HTML (only react hydration sets the correct title) #1456

Closed Anshuman71 closed 1 year ago

Anshuman71 commented 1 year ago

The commercetools Frontend Documentation page shows: "commercetools Composable Commerce documentation" as the title before React Hydration (JavaScript execution) and replaced with the correct title after hydration.

The static pre-generated site seems to have the "commercetools Composable Commerce documentation" as the title, only replaced by the correct one after React Hydration. It affects all open graph <meta> tags.

The image below is the Slack preview of the URL: https://docs.commercetools.com/docs/frontend.

08-12-2022-at-15-54-23@2x

Recreating the issue

Use the https://docs.commercetools.com/docs/frontend link in a Slack message and check the link preview.

or

Disable JavaScript in your browser and open the [URL](https://docs.commercetools.com/docs/frontend link) in the browser

08-12-2022-at-16-07-12@2x

nkuehn commented 1 year ago

@Anshuman71 thank you! I reworded the title a bit, a smaller delay would not fix it - the static pregenerated content has to be already containing the correct title.
Googles crawler runs javascript but most simpler snippet builders don't. So it has to be in the static page.

gabriele-ct commented 1 year ago

Relates to https://github.com/commercetools/commercetools-docs-kit/issues/1389 Agreed to try to use the new native Gatsby function and see if this fixes the issue. Currently we're relying on gatsby-plugin-react-helmet library.