forked from hazza/dspace-angular
change sitemap entries in robots.txt to absolute urls
This commit is contained in:
14
server.ts
14
server.ts
@@ -23,6 +23,7 @@ import * as pem from 'pem';
|
||||
import * as https from 'https';
|
||||
import * as morgan from 'morgan';
|
||||
import * as express from 'express';
|
||||
import * as ejs from 'ejs';
|
||||
import * as bodyParser from 'body-parser';
|
||||
import * as compression from 'compression';
|
||||
|
||||
@@ -120,10 +121,23 @@ export function app() {
|
||||
})(_, (options as any), callback)
|
||||
);
|
||||
|
||||
server.engine('ejs', ejs.renderFile);
|
||||
|
||||
/*
|
||||
* Register the view engines for html and ejs
|
||||
*/
|
||||
server.set('view engine', 'html');
|
||||
server.set('view engine', 'ejs');
|
||||
|
||||
/**
|
||||
* Serve the robots.txt ejs template, filling in the origin variable
|
||||
*/
|
||||
server.get('/robots.txt', (req, res) => {
|
||||
res.setHeader('content-type', 'text/plain');
|
||||
res.render('assets/robots.txt.ejs', {
|
||||
'origin': req.protocol + '://' + req.headers.host
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* Set views folder path to directory where template files are stored
|
||||
|
Reference in New Issue
Block a user