1.0.0 • Published 3 years ago

seo-csv v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Seo Csv Module

This is a very simple seo module for set meta tags from csv file on Nodejs.

Installation

$ npm install seo-csv

Configuration

Your seo.csv file with your seo meta in directory public/.

url;title;description;keywords
/;Home;Home;Home
/about;About;About;About

Add middleware in your app.js

app.use(
  require("seo-csv")({
    ignore: /^\/(images|js|css)/,
    namespace: "meta",
  })
);

app.use(function (req, res, next) {
    res.locals.meta = req.meta;
    next();
});

app.get("/", function (req, res) {
  res.render("index", res.locals.meta);
});

In view

<title>{{title}}</title>
<meta name="description" content="{{description}}" />
<meta name="keywords" content="{{keywords}}" />