Skip to content

Commit 6338045

Browse files
committed
Add whitelistUserAgents option
1 parent 34dda89 commit 6338045

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

handler.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ const resetPrerenderCloud = () => {
6363
// generally not recommended due to potential google SEO cloaking penalties no one fully understands
6464
// prerendercloud.set("botsOnly", true);
6565

66-
// 7. metaOnly
66+
// 7. whitelistUserAgents
67+
// specify your own list of bots
68+
// useful when you only care about open graph previews (in which case, metaOnly also makes sense)
69+
// prerendercloud.set('whitelistUserAgents', ['twitterbot', 'slackbot', 'facebookexternalhit']);
70+
71+
// 8. metaOnly
6772
// only prerender the <title> and <meta> tags in the <head> section. The returned HTML payload will otherwise be unmodified.
6873
// useful if you don't care about server-side rendering but want open-graph previews to work everywhere
6974
// must be a function that receives a req object, and returns a bool
@@ -72,7 +77,7 @@ const resetPrerenderCloud = () => {
7277
// eg2:
7378
// prerendercloud.set('metaOnly', () => true);
7479

75-
// 8. disableServerCache
80+
// 9. disableServerCache
7681
// Disable the cache on prerender.cloud (default is enabled with 5 minute duration).
7782
// It probably makes sense to disable the prerender.cloud server cache
7883
// since CloudFront is caching things for you.
@@ -85,21 +90,21 @@ const resetPrerenderCloud = () => {
8590
// things down unnecessarily)
8691
// prerendercloud.set('disableServerCache', true);
8792

88-
// 9. blacklistPaths
93+
// 10. blacklistPaths
8994
// the viewer-request function can't see what files exist on origin so you may need this
9095
// if you have HTML files that should not be pre-rendered (e.g. google/apple/fb verification files)
9196
// trailing * works as a wildcard
9297
// prerendercloud.set('blacklistPaths', req => ['/facebook-domain-verification.html', '/signin/*', '/google*']);
9398

94-
// 10. removeScriptsTag (not recommended)
99+
// 11. removeScriptsTag (not recommended)
95100
// Removes all scripts/JS, useful if:
96101
// - trying to get under 1MB Lambda@Edge limit
97102
// - having problems with your JS app taking over from the pre-rendered content
98103
// Huge caveat: this also means your app will no longer be a "single-page app" since
99104
// all of the JavaScript will be gone
100105
// prerendercloud.set("removeScriptTags", true);
101106

102-
// 11. disableAjaxPreload
107+
// 12. disableAjaxPreload
103108
// "Ajax Preload" is a monkey-patch, included by default when metaOnly is false/null.
104109
// It prevents screen flicker/repaint/flashing, but increases initial page load size
105110
// (because it embeds the AJAX responses into your HTML).
@@ -113,7 +118,7 @@ const resetPrerenderCloud = () => {
113118
// - https://github.com/sanfrancesco/prerendercloud-ajaxmonkeypatch
114119
// prerendercloud.set("disableAjaxPreload", true);
115120

116-
// 12. see all configuration options here: https://github.com/sanfrancesco/prerendercloud-nodejs
121+
// 13. see all configuration options here: https://github.com/sanfrancesco/prerendercloud-nodejs
117122

118123
// for tests
119124
if (prerenderCloudOption) prerenderCloudOption(prerendercloud);

0 commit comments

Comments
 (0)