Enonic version: 7.3.1
OS: Ubuntu
I built a redirect to an external web page, then when I open the content in the Content Studio it keeps loading endlessly.
example:
return {
redirect: "https://www.google.com/"
}
I built a redirect to an external web page, then when I open the content in the Content Studio it keeps loading endlessly.
example:
return {
redirect: "https://www.google.com/"
}
You should not redirect within content studio, but rather check rendering mode in your context, and Just display the link in the preview.
Rhuan, here is a quick code example that demonstrates what Thomas suggests above:
exports.get = function(request) {
if (request.mode === 'edit' || request.mode === 'inline') {
return {
body: 'This is a redirect, but it is disabled when shown in the Content Studio browse view. It will redirect here: <a href="https://www.google.com">https://www.google.com</a>',
contentType: 'text/html; charset="UTF-8"'
};
} else {
return {
redirect: 'https://www.google.com/'
};
}
}
Using this pattern should solve your problem.
Thank you for the help guys, your approach solve my problem ;]