fix: favicon, apple touch icon, etc not loaded from CDN
This commit is contained in:
@@ -65,7 +65,9 @@ export const renderApp = async (
|
||||
const { shareId } = ctx.params;
|
||||
const page = await readIndexFile();
|
||||
const environment = `
|
||||
window.env = ${JSON.stringify(presentEnv(env, options.analytics))};
|
||||
<script>
|
||||
window.env = ${JSON.stringify(presentEnv(env, options.analytics))};
|
||||
</script>
|
||||
`;
|
||||
const entry = "app/index.tsx";
|
||||
const scriptTags = isProduction
|
||||
@@ -85,13 +87,14 @@ export const renderApp = async (
|
||||
|
||||
ctx.body = page
|
||||
.toString()
|
||||
.replace(/\/\/inject-env\/\//g, environment)
|
||||
.replace(/\/\/inject-title\/\//g, escape(title))
|
||||
.replace(/\/\/inject-description\/\//g, escape(description))
|
||||
.replace(/\/\/inject-canonical\/\//g, canonical)
|
||||
.replace(/\/\/inject-prefetch\/\//g, shareId ? "" : prefetchTags)
|
||||
.replace(/\/\/inject-slack-app-id\/\//g, env.SLACK_APP_ID || "")
|
||||
.replace(/\/\/inject-script-tags\/\//g, scriptTags);
|
||||
.replace(/\{env\}/g, environment)
|
||||
.replace(/\{title\}/g, escape(title))
|
||||
.replace(/\{description\}/g, escape(description))
|
||||
.replace(/\{canonical-url\}/g, canonical)
|
||||
.replace(/\{prefetch\}/g, shareId ? "" : prefetchTags)
|
||||
.replace(/\{slack-app-id\}/g, env.SLACK_APP_ID || "")
|
||||
.replace(/\{cdn-url\}/g, env.CDN_URL || "")
|
||||
.replace(/\{script-tags\}/g, scriptTags);
|
||||
};
|
||||
|
||||
export const renderShare = async (ctx: Context, next: Next) => {
|
||||
|
||||
@@ -1,36 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>//inject-title//</title>
|
||||
<title>{title}</title>
|
||||
<meta name="theme-color" content="#FFF" />
|
||||
<meta name="slack-app-id" content="//inject-slack-app-id//" />
|
||||
<meta name="slack-app-id" content="{slack-app-id}" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="description" content="//inject-description//" />
|
||||
<link rel="manifest" href="/static/manifest.webmanifest" />
|
||||
<link
|
||||
rel="canonical"
|
||||
href="//inject-canonical//"
|
||||
data-react-helmet="true"
|
||||
/>
|
||||
//inject-prefetch//
|
||||
<meta name="description" content="{description}" />
|
||||
<link rel="manifest" href="{cdn-url}/static/manifest.webmanifest" />
|
||||
<link rel="canonical" href="{canonical-url}" data-react-helmet="true" />
|
||||
{prefetch}
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
type="image/png"
|
||||
href="/static/images/favicon-32.png"
|
||||
href="{cdn-url}/static/images/favicon-32.png"
|
||||
sizes="32x32"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
type="image/png"
|
||||
href="/static/images/apple-touch-icon.png"
|
||||
href="{cdn-url}/static/images/apple-touch-icon.png"
|
||||
sizes="192x192"
|
||||
/>
|
||||
<link
|
||||
rel="search"
|
||||
type="application/opensearchdescription+xml"
|
||||
href="/opensearch.xml"
|
||||
href="{cdn-url}/opensearch.xml"
|
||||
title="Outline"
|
||||
/>
|
||||
<style>
|
||||
@@ -56,9 +52,7 @@
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script>
|
||||
//inject-env//
|
||||
</script>
|
||||
{env}
|
||||
<script>
|
||||
if (
|
||||
window.localStorage &&
|
||||
@@ -71,6 +65,6 @@
|
||||
.setAttribute("content", color);
|
||||
}
|
||||
</script>
|
||||
//inject-script-tags//
|
||||
{script-tags}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user