digitalbazaar/bedrock-prerender

Name: bedrock-prerender

Owner: Digital Bazaar, Inc.

Description: null

Created: 2016-10-12 19:25:53.0

Updated: 2016-10-21 20:32:13.0

Pushed: 2017-11-13 18:34:36.0

Homepage: null

Size: 16

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

bedrock-prerender

Build Status

This is a bedrock-based library that provides a PhantomJS rendering engine that can be used to render HTML from AngularJS pages. This allows bots that do not execute Javascript on pages to parse and index pages properly.

The site must be minified/optimized for the rending engine to function properly.

Pages connected with defined routes are rendered to HTML the first time they are requested and added to a Redis cache. Subsequent requests for the same route will be served directly from the Redis cache until the specified time to live (TTL) has expired. Only bot request containing a User-Agent header in the list of defined crawlerUserAgents will be rendered. All other requests will be handled normally.

Quick Examples
config = require('bedrock').config;

efault TTL (sec) for all URLs added to cache
ig.prerender.cache.ttl = 10000; // default: 300

rerending is enabled only on defined routes.
n optional route specific `cacheTtl` (sec) may be specified.
ig.prerender.routes = {
about': {cacheTtl: 10000},
i/*': {}

Simulate a bot request for testing
 -k -A twitterbot https://bedrock.dev:18443/about

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.