From 156d7ec29cabd17a68b364d53d24511bb168cf05 Mon Sep 17 00:00:00 2001 From: Sing Ming Chen Date: Wed, 1 Nov 2023 11:39:48 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20canonical=20url=20tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/components/movieDetailTabs.tsx | 1 + src/index.html | 107 ++++++++++++++----------- src/server.tsx | 5 +- 3 files changed, 65 insertions(+), 48 deletions(-) diff --git a/src/app/components/movieDetailTabs.tsx b/src/app/components/movieDetailTabs.tsx index 38b40a5..9001fea 100644 --- a/src/app/components/movieDetailTabs.tsx +++ b/src/app/components/movieDetailTabs.tsx @@ -118,6 +118,7 @@ export default class MovieDetailTabs extends React.PureComponent diff --git a/src/index.html b/src/index.html index c005502..6b602be 100644 --- a/src/index.html +++ b/src/index.html @@ -1,51 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + {% if meta.canonicalUrl %} + + {% endif %} + {{ title }} + - - - - - - - - - - - - - - - - - - - - - - - {{ title }} - + + - - - - -
-
{{ html|safe }}
-
- - - - - \ No newline at end of file +
+
{{ html|safe }}
+
+ {{ apolloState|safe }} + + diff --git a/src/server.tsx b/src/server.tsx index 8d64312..466a0d4 100644 --- a/src/server.tsx +++ b/src/server.tsx @@ -108,7 +108,10 @@ app.use(basicCache, function (req, res, next) { title: global.document.title, meta: global.document.meta, html: content, - apolloState: `window.__APOLLO_STATE__=${JSON.stringify(initialState).replace(/window.__APOLLO_STATE__=${JSON.stringify(initialState).replace( + /`, }); res.status(context['status'] || 200).send(page); },