diff --git a/javascript/src/index.ts b/javascript/src/index.ts index bb0d963..50808f8 100644 --- a/javascript/src/index.ts +++ b/javascript/src/index.ts @@ -52,10 +52,7 @@ export interface ErrorPageParams { } // Load EJS template -export const baseTemplate: ejs.TemplateFunction = ejs.compile(templateString, { - rmWhitespace: true -}); - +export const baseTemplate: ejs.TemplateFunction = ejs.compile(templateString); /** * Generate random hex string for ray-id */ diff --git a/javascript/src/templates/template.ejs b/javascript/src/templates/template.ejs index cf31de5..8a67629 100644 --- a/javascript/src/templates/template.ejs +++ b/javascript/src/templates/template.ejs @@ -4,9 +4,9 @@ -<% const error_code = params.error_code || 500; %> -<% const title = params.title || 'Internal server error'; %> -<% const html_title = params.html_title || (error_code + ': ' + title); %> +<% const error_code = params.error_code || 500; -%> +<% const title = params.title || 'Internal server error'; -%> +<% const html_title = params.html_title || (error_code + ': ' + title); -%> <%= html_title %> @@ -14,7 +14,7 @@ @@ -25,18 +25,18 @@ <%= title %> Error code <%= error_code %> - <% const more_info = params.more_information || {}; %> - <% if (!more_info.hidden) { %> + <%_ const more_info = params.more_information || {}; -%> + <%_ if (!more_info.hidden) { -%>
Visit <%= more_info.text || 'cloudflare.com' %> for <%= more_info.for || 'more information' %>.
- <% } %> + <%_ } -%>
<%= params.time %>
-
+
- <% + <%_ const items = [ { id: 'browser', icon: 'browser', default_location: 'You', default_name: 'Browser' }, { id: 'cloudflare', icon: 'cloud', default_location: 'San Francisco', default_name: 'Cloudflare' }, @@ -55,7 +55,7 @@ } const status_text = item.status_text || (status === 'ok' ? 'Working' : 'Error'); const is_error_source = params.error_source === id; - %> + -%>
@@ -65,7 +65,7 @@

><%= item.name || default_name %>

<%= status_text %>
- <% }); %> + <%_ }); -%>
@@ -95,12 +95,11 @@ <% const perf_sec_by = params.perf_sec_by || {}; %> Performance & security by <%= perf_sec_by.text || 'Cloudflare' %> - - <% const creator_info = params.creator_info || {}; %> - <% if (!(creator_info.hidden ?? true)) { %> + <%_ const creator_info = params.creator_info || {}; _%> + <%_ if (!(creator_info.hidden ?? true)) { _%> Created with <%= creator_info.text %> - <% } %> + <%_ } -%>