forked from hazza/dspace-angular
Merge pull request #2037 from atmire/fully-qualified-sitemap-urls-7.5-next
Add support for fully qualified sitemap urls
This commit is contained in:
@@ -93,6 +93,7 @@
|
||||
"date-fns": "^2.29.3",
|
||||
"date-fns-tz": "^1.3.7",
|
||||
"deepmerge": "^4.2.2",
|
||||
"ejs": "^3.1.8",
|
||||
"express": "^4.17.1",
|
||||
"express-rate-limit": "^5.1.3",
|
||||
"fast-json-patch": "^3.0.0-1",
|
||||
@@ -147,6 +148,7 @@
|
||||
"@ngtools/webpack": "^13.2.6",
|
||||
"@nguniversal/builders": "^13.1.1",
|
||||
"@types/deep-freeze": "0.1.2",
|
||||
"@types/ejs": "^3.1.1",
|
||||
"@types/express": "^4.17.9",
|
||||
"@types/jasmine": "~3.6.0",
|
||||
"@types/js-cookie": "2.2.6",
|
||||
|
14
server.ts
14
server.ts
@@ -22,6 +22,7 @@ import 'rxjs';
|
||||
/* eslint-disable import/no-namespace */
|
||||
import * as morgan from 'morgan';
|
||||
import * as express from 'express';
|
||||
import * as ejs from 'ejs';
|
||||
import * as compression from 'compression';
|
||||
import * as expressStaticGzip from 'express-static-gzip';
|
||||
/* eslint-enable import/no-namespace */
|
||||
@@ -136,10 +137,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
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# The URL to the DSpace sitemaps
|
||||
# XML sitemap is listed first as it is preferred by most search engines
|
||||
Sitemap: /sitemap_index.xml
|
||||
Sitemap: /sitemap_index.html
|
||||
Sitemap: <%= origin %>/sitemap_index.xml
|
||||
Sitemap: <%= origin %>/sitemap_index.html
|
||||
|
||||
##########################
|
||||
# Default Access Group
|
@@ -47,8 +47,8 @@ export const copyWebpackOptions = {
|
||||
},
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '..', 'src', 'robots.txt'),
|
||||
to: 'robots.txt'
|
||||
from: path.join(__dirname, '..', 'src', 'robots.txt.ejs'),
|
||||
to: 'assets/robots.txt.ejs'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@@ -2187,6 +2187,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/deep-freeze/-/deep-freeze-0.1.2.tgz#68e5379291910e82c2f0d1629732163c2aa662cc"
|
||||
integrity sha512-M6x29Vk4681dght4IMnPIcF1SNmeEm0c4uatlTFhp+++H1oDK1THEIzuCC2WeCBVhX+gU0NndsseDS3zaCtlcQ==
|
||||
|
||||
"@types/ejs@^3.1.1":
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/ejs/-/ejs-3.1.1.tgz#29c539826376a65e7f7d672d51301f37ed718f6d"
|
||||
integrity sha512-RQul5wEfY7BjWm0sYY86cmUN/pcXWGyVxWX93DFFJvcrxax5zKlieLwA3T77xJGwNcZW0YW6CYG70p1m8xPFmA==
|
||||
|
||||
"@types/eslint-scope@^3.7.3":
|
||||
version "3.7.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.4.tgz#37fc1223f0786c39627068a12e94d6e6fc61de16"
|
||||
@@ -4712,7 +4717,7 @@ ee-first@1.1.1:
|
||||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==
|
||||
|
||||
ejs@^3.1.5:
|
||||
ejs@^3.1.5, ejs@^3.1.8:
|
||||
version "3.1.8"
|
||||
resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.8.tgz#758d32910c78047585c7ef1f92f9ee041c1c190b"
|
||||
integrity sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==
|
||||
|
Reference in New Issue
Block a user