Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-middleware-seo

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-middleware-seo

express middleware for serving prerendered javascript-rendered pages for SEO

  • 1.0.4
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Npm Package Npm Downloads Dependency Status travis-ci

express-middleware-seo

SEO middleware for express base on chrome-render, a substitute for prerender.

Modern web app use technique like react.js vue.js which render html in browser, this lead to search engine can't crawl your page content.

This project want to solve this kind of problem in a general-purpose way, it detect request is from search engine crawler then use headless chrome to render out your modern web page and return to crawler.

Here is express-middleware-seo's architecture diagram: express-middleware-seo arch

Use

npm i express-middleware-seo

then use it:

const express = require('express')
const path = require('path')
const app = express()
const { seoMiddleware } = require('express-middleware-seo')

app.use(
  seoMiddleware({
    enable: true,
    render: {
      useReady: true,
      renderTimeout: 10000
    }
  })
)

app.use(express.static(__dirname + '/static'))

app.listen(3000)

you can download and run this complete demo

Notice

You should install Chrome 59+ in your servers before you use this middleware

Options

options come form chrome-render

  • maxTab: number max tab chrome will open to render pages, default is no limit, maxTab used to avoid open to many tab lead to chrome crash. ChromeRender will create a tab poll to reuse tab for performance improve and resource reduce as open and close tab in chrome require time, like database connection poll.
  • renderTimeout: number in ms, chromeRender.render() will throw error if html string can't be resolved after renderTimeout, default is 5000ms.
  • useReady: boolean whether use window.isPageReady=1 to notify chrome-render page has ready. default is false chrome-render use domContentEventFired as page has ready.
  • script: string is an option param. inject script source to evaluate when page on load

Friends

Keywords

FAQs

Package last updated on 12 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc