5htp-core 0.4.4-1 → 0.4.4-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "5htp-core",
|
|
3
3
|
"description": "Convenient TypeScript framework designed for Performance and Productivity.",
|
|
4
|
-
"version": "0.4.4-
|
|
4
|
+
"version": "0.4.4-2",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp-core.git",
|
|
7
7
|
"license": "MIT",
|
|
@@ -57,31 +57,26 @@ export default class DocumentRenderer<TRouter extends Router> {
|
|
|
57
57
|
|
|
58
58
|
public async page( html: string, page: Page, response: ServerResponse<TRouter> ) {
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
// TODO: can be customized via page / route config
|
|
61
|
+
const canonicalUrl = response.request.req.url;
|
|
61
62
|
|
|
62
63
|
let attrsBody = {
|
|
63
64
|
className: [...page.bodyClass].join(' '),
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
return '<!doctype html>' + renderToString(
|
|
67
|
-
<html lang="en"
|
|
68
|
+
<html lang="en">
|
|
68
69
|
<head>
|
|
69
70
|
{/* Format */}
|
|
70
71
|
<meta charSet="utf-8" />
|
|
71
|
-
{page.amp && ( // As a best practice, you should include the script as early as possible in the <head>.
|
|
72
|
-
<script async={true} src="https://cdn.ampproject.org/v0.js"></script>
|
|
73
|
-
)}
|
|
74
72
|
<meta content="IE=edge" httpEquiv="X-UA-Compatible" />
|
|
75
73
|
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1" />
|
|
76
|
-
{!page.amp && page.amp && (
|
|
77
|
-
<link rel="amphtml" href={fullUrl + '/amp'} />
|
|
78
|
-
)}
|
|
79
74
|
|
|
80
75
|
{/* Basique*/}
|
|
81
76
|
<meta content={this.app.identity.web.title} name="apple-mobile-web-app-title" />
|
|
82
77
|
<title>{page.title}</title>
|
|
83
78
|
<meta content={page.description} name="description" />
|
|
84
|
-
<link rel="canonical" href={
|
|
79
|
+
<link rel="canonical" href={canonicalUrl} />
|
|
85
80
|
|
|
86
81
|
{this.metas( page )}
|
|
87
82
|
|
|
@@ -147,9 +142,6 @@ export default class DocumentRenderer<TRouter extends Router> {
|
|
|
147
142
|
</> : <>
|
|
148
143
|
<style id={style.id} dangerouslySetInnerHTML={{ __html: style.inline }} />
|
|
149
144
|
</>)}
|
|
150
|
-
|
|
151
|
-
{/* Sera remplacé par la chaine exacte après renderToStaticMarkup */}
|
|
152
|
-
{page.amp && (<style amp-boilerplate=""></style>)}
|
|
153
145
|
</>
|
|
154
146
|
}
|
|
155
147
|
|
|
@@ -161,13 +153,11 @@ export default class DocumentRenderer<TRouter extends Router> {
|
|
|
161
153
|
|
|
162
154
|
return <>
|
|
163
155
|
{/* JS */}
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}} />
|
|
170
|
-
)}
|
|
156
|
+
<script type="text/javascript" dangerouslySetInnerHTML={{
|
|
157
|
+
__html: `window.ssr=${context}; window.routes=${routesForClient};` + (
|
|
158
|
+
this.app.env.profile === 'dev' ? 'window.dev = true;' : ''
|
|
159
|
+
)
|
|
160
|
+
}} />
|
|
171
161
|
|
|
172
162
|
<link rel="preload" href={"/public/client.js?v=" + BUILD_ID} as="script" />
|
|
173
163
|
<script defer type="text/javascript" src={"/public/client.js?v=" + BUILD_ID} />
|
|
@@ -83,11 +83,7 @@ export default class Page<TRouter extends Router = Router> extends PageResponse<
|
|
|
83
83
|
attrsBody.className += ' ' + page.classeBody.join(' ');
|
|
84
84
|
|
|
85
85
|
if (page.theme)
|
|
86
|
-
attrsBody.className += ' ' + page.theme
|
|
87
|
-
|
|
88
|
-
// L'url canonique doit pointer vers la version html
|
|
89
|
-
if (page.amp && fullUrl.endsWith('/amp'))
|
|
90
|
-
fullUrl = fullUrl.substring(0, fullUrl.length - 4);*/
|
|
86
|
+
attrsBody.className += ' ' + page.theme;*/
|
|
91
87
|
|
|
92
88
|
return this.router.render.page(html, this, this.context.response);
|
|
93
89
|
}
|
|
@@ -113,9 +109,7 @@ export default class Page<TRouter extends Router = Router> extends PageResponse<
|
|
|
113
109
|
id: chunk,
|
|
114
110
|
url: '/public/' + asset
|
|
115
111
|
})
|
|
116
|
-
|
|
117
|
-
// Sauf si mode dev, car le hot reload est quand même bien pratique ...
|
|
118
|
-
else if (!this.amp)
|
|
112
|
+
else
|
|
119
113
|
this.scripts.push({
|
|
120
114
|
id: chunk,
|
|
121
115
|
url: '/public/' + asset
|