Skip to content

Commit ff71fdc

Browse files
fix(website): correctly set crawler url target
1 parent bc270d6 commit ff71fdc

File tree

1 file changed

+5
-2
lines changed
  • packages/overmind-website/backend

1 file changed

+5
-2
lines changed

packages/overmind-website/backend/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,21 @@ const apis = getApis()
104104
const searchData = getSearchData()
105105

106106
const googleCrawlMiddleware = async function ssr(req, res, next) {
107+
const url = req.protocol + '://' + req.hostname + req.path
108+
107109
if (
108110
req
109111
.get('user-agent')
110112
.toLowerCase()
111-
.indexOf('googlebot') >= 0
113+
.indexOf('googlebot') >= 0 &&
114+
!path.extname(url)
112115
) {
113116
const browser = await puppeteer.launch({
114117
headless: true,
115118
args: ['--no-sandbox'],
116119
})
117120
const page = await browser.newPage()
118-
await page.goto(req.hostname + req.path, { waitUntil: 'networkidle0' })
121+
await page.goto(url, { waitUntil: 'networkidle0' })
119122
const html = await page.content()
120123
await browser.close()
121124

0 commit comments

Comments
 (0)