5htp-core 0.2.6-9 → 0.2.7
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.2.
|
|
4
|
+
"version": "0.2.7",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp-core.git",
|
|
7
7
|
"license": "MIT",
|
package/src/server/app/config.ts
CHANGED
|
@@ -22,6 +22,11 @@ const chunks = require('./chunk-manifest.json');
|
|
|
22
22
|
- TYPES
|
|
23
23
|
----------------------------------*/
|
|
24
24
|
|
|
25
|
+
const seoLimits = {
|
|
26
|
+
title: 70,
|
|
27
|
+
description: 255
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
/*----------------------------------
|
|
26
31
|
- FONCTION
|
|
27
32
|
----------------------------------*/
|
|
@@ -35,7 +40,8 @@ export default class Page<TRouter extends Router = Router> extends PageResponse<
|
|
|
35
40
|
public layout?: Layout,
|
|
36
41
|
|
|
37
42
|
public route = context.route,
|
|
38
|
-
public
|
|
43
|
+
public app = context.app,
|
|
44
|
+
public router = context.request.router,
|
|
39
45
|
|
|
40
46
|
) {
|
|
41
47
|
|
|
@@ -45,6 +51,16 @@ export default class Page<TRouter extends Router = Router> extends PageResponse<
|
|
|
45
51
|
|
|
46
52
|
public render(): Promise<string> {
|
|
47
53
|
|
|
54
|
+
// Complete SEO metadatas
|
|
55
|
+
const titleSuffix = ' | ' + this.app.identity.web.titleSuffix
|
|
56
|
+
if (this.title === undefined)
|
|
57
|
+
this.title = this.app.identity.web.fullTitle;
|
|
58
|
+
else if (this.title.length < seoLimits.title - titleSuffix.length)
|
|
59
|
+
this.title += titleSuffix;
|
|
60
|
+
|
|
61
|
+
if (this.description === undefined)
|
|
62
|
+
this.description = this.app.identity.web.description;
|
|
63
|
+
|
|
48
64
|
// We render page & document separatly,
|
|
49
65
|
// because document needs to access to runtime assigned values
|
|
50
66
|
// Ex: runtime added scripts, title, metas, ....
|