'The ability to have pretty formatted HTML with Next Js [duplicate]

I am using the Nextjs framework and my pages are dynamically generated.

When I view the page source code - it is displayed in an unreadable format.

Is it possible to create a 'pretty' formatted HTML for the application created with NextJs?

I have such request from an SEO optimization manager.

View page source modal

Page source



Solution 1:[1]

Received this answer from NextJs team

There is no "options" within Next.js to achieve this.

One way to do it would be to create a custom server and prettify the response yourself. While I don't advocate to make a custom server just for this, some might have found success in doing so.

I find it "weird" to prettify HTML for SEO reason though. Search engines are well capable of parsing minified HTML and "prettifying" the output will add weight to the page.

More height means less performance and that could impact SEO in a negative way.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Devzhen