Hey so I am trying to inject my site with the facebook og:meta-tags. I am using express and this library: http://ift.tt/1NafN87
It seems east, but I can't get it to work.
I have my client-side written separately from my server. And I have node-js hosting my server (mainly for heroku).
My server is all this:
var express = require('express');
var morgan = require('morgan');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var OG = require('express-metatag')('og');
var app = express();
var port = process.env.PORT || 3000;
var router = express.Router();
//-----------------------------------------
// set the static files location
// for the static html
//-----------------------------------------
app.use(express.static(__dirname + '/dist'));
app.use(express.static(__dirname + '/dist/views'));
app.use(morgan('dev')); // log every request to the console
app.use(bodyParser()); // pull information from html in POST
app.use(methodOverride()); // simulate DELETE and PUT
app.use(OG([{
title: 'Hello World',
description: 'Amazing module'
}]);
router.get('/', function(req, res, next) {
res.render('index.html');
});
app.use('/', router);
app.listen(port);
console.log('App running on port', port);
I have no clue how the server-hosting works here, so treat me like a total newbie... This currently does not work.
Aucun commentaire:
Enregistrer un commentaire