mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Restrict SSR to paths in the sitemap
Because Angular SSR is not very efficient, after discussion with the Google Scholar team we realized a compromise would be to only use SSR for pages in the DSpace sitemap (and the home page).
This commit is contained in:
@@ -23,6 +23,8 @@ ssr:
|
|||||||
# Determining which styles are critical is a relatively expensive operation; this option is
|
# Determining which styles are critical is a relatively expensive operation; this option is
|
||||||
# disabled (false) by default to boost server performance at the expense of loading smoothness.
|
# disabled (false) by default to boost server performance at the expense of loading smoothness.
|
||||||
inlineCriticalCss: false
|
inlineCriticalCss: false
|
||||||
|
# Path prefixes to enable SSR for. By default these are limited to paths of primary DSpace objects.
|
||||||
|
paths: [ '/home', '/items/', '/entities/', '/collections/', '/communities/', '/bitstream/', '/bitstreams/', '/handle/' ]
|
||||||
|
|
||||||
# The REST API server settings
|
# The REST API server settings
|
||||||
# NOTE: these settings define which (publicly available) REST API to use. They are usually
|
# NOTE: these settings define which (publicly available) REST API to use. They are usually
|
||||||
|
@@ -238,7 +238,7 @@ export function app() {
|
|||||||
* The callback function to serve server side angular
|
* The callback function to serve server side angular
|
||||||
*/
|
*/
|
||||||
function ngApp(req, res) {
|
function ngApp(req, res) {
|
||||||
if (environment.universal.preboot) {
|
if (environment.universal.preboot && req.method === 'GET' && (req.path === '/' || environment.universal.paths.some(pathPrefix => req.path.startsWith(pathPrefix)))) {
|
||||||
// Render the page to user via SSR (server side rendering)
|
// Render the page to user via SSR (server side rendering)
|
||||||
serverSideRender(req, res);
|
serverSideRender(req, res);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -13,4 +13,9 @@ export interface UniversalConfig extends Config {
|
|||||||
* loading smoothness.
|
* loading smoothness.
|
||||||
*/
|
*/
|
||||||
inlineCriticalCss?: boolean;
|
inlineCriticalCss?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paths to enable SSR for. Defaults to the home page and paths in the sitemap.
|
||||||
|
*/
|
||||||
|
paths: Array<string>;
|
||||||
}
|
}
|
||||||
|
@@ -9,5 +9,6 @@ export const environment: Partial<BuildConfig> = {
|
|||||||
async: true,
|
async: true,
|
||||||
time: false,
|
time: false,
|
||||||
inlineCriticalCss: false,
|
inlineCriticalCss: false,
|
||||||
|
paths: [ '/home', '/items/', '/entities/', '/collections/', '/communities/', '/bitstream/', '/bitstreams/', '/handle/' ],
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -12,6 +12,7 @@ export const environment: BuildConfig = {
|
|||||||
async: true,
|
async: true,
|
||||||
time: false,
|
time: false,
|
||||||
inlineCriticalCss: false,
|
inlineCriticalCss: false,
|
||||||
|
paths: [ '/home', '/items/', '/entities/', '/collections/', '/communities/', '/bitstream/', '/bitstreams/', '/handle/' ],
|
||||||
},
|
},
|
||||||
|
|
||||||
// Angular Universal server settings.
|
// Angular Universal server settings.
|
||||||
|
@@ -14,6 +14,7 @@ export const environment: Partial<BuildConfig> = {
|
|||||||
async: true,
|
async: true,
|
||||||
time: false,
|
time: false,
|
||||||
inlineCriticalCss: false,
|
inlineCriticalCss: false,
|
||||||
|
paths: [ '/home', '/items/', '/entities/', '/collections/', '/communities/', '/bitstream/', '/bitstreams/', '/handle/' ],
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user