This library renders your application, strips the script tags, and returns the static HTML for a given URL. The generated HTML can be used to serve spiders and crawlers in order to improve SEO.
Originally made for Angular but works for any single page applications or website.
Install the library using yarn add angular-statisfy
.
The default usage of statisfy can be found in the code below.
import {launch} from 'puppeteer';
import {generateStaticHtml} from './generate-static';
(async () => {
const browser = await launch({
args: ['--no-sandbox'],
});
const html = await generateStaticHtml('https://bookingworldspeakers.com', browser);
await browser.close();
})().catch(console.error);