@quintype/framework 7.18.8 → 7.18.9-seo-metadata.0
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
|
@@ -42,6 +42,8 @@ function writeStaticPageResponse(res, url, page, result, { config, renderLayout,
|
|
|
42
42
|
store,
|
|
43
43
|
seoTags,
|
|
44
44
|
disableAjaxNavigation: true,
|
|
45
|
+
enableHeader: page.metadata.header,
|
|
46
|
+
enableFooter: page.metadata.footer,
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -91,20 +93,17 @@ exports.customRouteHandler = function customRouteHandler(
|
|
|
91
93
|
});
|
|
92
94
|
addStaticPageMimeType({ res, page });
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
seo,
|
|
104
|
-
});
|
|
96
|
+
return loadData("custom-static-page", {}, config, client, {
|
|
97
|
+
host: req.hostname,
|
|
98
|
+
domainSlug,
|
|
99
|
+
cookies: req.cookies,
|
|
100
|
+
}).then((response) => {
|
|
101
|
+
return writeStaticPageResponse(res, url, page.page, response, {
|
|
102
|
+
config,
|
|
103
|
+
renderLayout,
|
|
104
|
+
seo,
|
|
105
105
|
});
|
|
106
|
-
}
|
|
107
|
-
return res.send(page.content);
|
|
106
|
+
});
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
return next();
|
|
@@ -48,8 +48,7 @@ function getClientStub(hostname) {
|
|
|
48
48
|
page: {
|
|
49
49
|
id: 103,
|
|
50
50
|
title: "Testing",
|
|
51
|
-
content:
|
|
52
|
-
"<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
|
|
51
|
+
content: "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
|
|
53
52
|
metadata: { header: true, footer: false },
|
|
54
53
|
type: "static-page",
|
|
55
54
|
"status-code": 200,
|
|
@@ -60,8 +59,7 @@ function getClientStub(hostname) {
|
|
|
60
59
|
page: {
|
|
61
60
|
id: 104,
|
|
62
61
|
title: "Testing",
|
|
63
|
-
content:
|
|
64
|
-
"<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
|
|
62
|
+
content: "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
|
|
65
63
|
metadata: { header: false, footer: false },
|
|
66
64
|
type: "static-page",
|
|
67
65
|
"status-code": 200,
|
|
@@ -72,8 +70,7 @@ function getClientStub(hostname) {
|
|
|
72
70
|
page: {
|
|
73
71
|
id: 105,
|
|
74
72
|
title: "Testing mime type",
|
|
75
|
-
content:
|
|
76
|
-
"<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
|
|
73
|
+
content: "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
|
|
77
74
|
metadata: {
|
|
78
75
|
header: false,
|
|
79
76
|
footer: false,
|
|
@@ -104,9 +101,7 @@ function createApp(loadData, routes, opts = {}) {
|
|
|
104
101
|
generateRoutes: () => routes,
|
|
105
102
|
loadData,
|
|
106
103
|
renderLayout: (res, { contentTemplate, store }) =>
|
|
107
|
-
res.send(
|
|
108
|
-
JSON.stringify({ contentTemplate, store: store.getState() })
|
|
109
|
-
),
|
|
104
|
+
res.send(JSON.stringify({ contentTemplate, store: store.getState() })),
|
|
110
105
|
handleNotFound: false,
|
|
111
106
|
publisherConfig: {},
|
|
112
107
|
},
|
|
@@ -126,10 +121,7 @@ describe("Custom Route Handler", function () {
|
|
|
126
121
|
supertest(app)
|
|
127
122
|
.get("/moved-permanently")
|
|
128
123
|
.expect("Location", "/permanent-location")
|
|
129
|
-
.expect(
|
|
130
|
-
"Cache-Control",
|
|
131
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
132
|
-
)
|
|
124
|
+
.expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
|
|
133
125
|
.expect("Vary", /Accept\-Encoding/)
|
|
134
126
|
.expect("Surrogate-Key", "u/42/101")
|
|
135
127
|
.expect("Cache-Tag", "u/42/101")
|
|
@@ -144,10 +136,7 @@ describe("Custom Route Handler", function () {
|
|
|
144
136
|
supertest(app)
|
|
145
137
|
.get("/moved-temporarily")
|
|
146
138
|
.expect("Location", "/temporary-location")
|
|
147
|
-
.expect(
|
|
148
|
-
"Cache-Control",
|
|
149
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
150
|
-
)
|
|
139
|
+
.expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
|
|
151
140
|
.expect("Vary", /Accept\-Encoding/)
|
|
152
141
|
.expect("Surrogate-Key", "u/42/102")
|
|
153
142
|
.expect("Cache-Tag", "u/42/102")
|
|
@@ -163,10 +152,7 @@ describe("Custom Route Handler", function () {
|
|
|
163
152
|
supertest(app)
|
|
164
153
|
.get("/static-with-header-footer")
|
|
165
154
|
.expect("Content-Type", /html/)
|
|
166
|
-
.expect(
|
|
167
|
-
"Cache-Control",
|
|
168
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
169
|
-
)
|
|
155
|
+
.expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
|
|
170
156
|
.expect("Vary", "Accept-Encoding")
|
|
171
157
|
.expect("Surrogate-Key", "u/42/103")
|
|
172
158
|
.expect("Cache-Tag", "u/42/103")
|
|
@@ -180,31 +166,6 @@ describe("Custom Route Handler", function () {
|
|
|
180
166
|
.then(done);
|
|
181
167
|
});
|
|
182
168
|
|
|
183
|
-
it("Renders the page by sending the content if it's a static page with disabled header and footer", function (done) {
|
|
184
|
-
const app = createApp(
|
|
185
|
-
(pageType, params, config, client, { host, next }) => next(),
|
|
186
|
-
[{ pageType: "story-page", path: "/*" }]
|
|
187
|
-
);
|
|
188
|
-
supertest(app)
|
|
189
|
-
.get("/static-without-header-footer")
|
|
190
|
-
.expect("Content-Type", /html/)
|
|
191
|
-
.expect(
|
|
192
|
-
"Cache-Control",
|
|
193
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
194
|
-
)
|
|
195
|
-
.expect("Vary", "Accept-Encoding")
|
|
196
|
-
.expect("Surrogate-Key", "u/42/104")
|
|
197
|
-
.expect("Cache-Tag", "u/42/104")
|
|
198
|
-
.expect(200)
|
|
199
|
-
.then((res) => {
|
|
200
|
-
assert.equal(
|
|
201
|
-
"<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
|
|
202
|
-
res.text
|
|
203
|
-
);
|
|
204
|
-
})
|
|
205
|
-
.then(done);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
169
|
it("Returns 404 if the route doesn't exist", function (done) {
|
|
209
170
|
const app = createApp(
|
|
210
171
|
(pageType, params, config, client, { host, next }) => next(),
|
|
@@ -233,9 +194,7 @@ describe("Custom Route Handler", function () {
|
|
|
233
194
|
it("Store reads config and data from data-loader response", function (done) {
|
|
234
195
|
const app = createApp(
|
|
235
196
|
(pageType, params, config, client, { host, next }) =>
|
|
236
|
-
pageType === "custom-static-page"
|
|
237
|
-
? Promise.resolve({ data: { navigationMenu: [] }, config: {} })
|
|
238
|
-
: next(),
|
|
197
|
+
pageType === "custom-static-page" ? Promise.resolve({ data: { navigationMenu: [] }, config: {} }) : next(),
|
|
239
198
|
[{ pageType: "story-page", path: "/*" }]
|
|
240
199
|
);
|
|
241
200
|
supertest(app)
|
|
@@ -258,49 +217,10 @@ describe("Custom Route Handler", function () {
|
|
|
258
217
|
supertest(app)
|
|
259
218
|
.get("/moved-absolute")
|
|
260
219
|
.expect("Location", "https://www.google.com")
|
|
261
|
-
.expect(
|
|
262
|
-
"Cache-Control",
|
|
263
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
264
|
-
)
|
|
220
|
+
.expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
|
|
265
221
|
.expect("Vary", /Accept\-Encoding/)
|
|
266
222
|
.expect("Surrogate-Key", "u/42/105")
|
|
267
223
|
.expect("Cache-Tag", "u/42/105")
|
|
268
224
|
.expect(301, done);
|
|
269
225
|
});
|
|
270
|
-
|
|
271
|
-
it("Adds content type as per metadata in response", function (done) {
|
|
272
|
-
const app = createApp(
|
|
273
|
-
(pageType, params, config, client, { host, next }) => next(),
|
|
274
|
-
[{ pageType: "story-page", path: "/*" }]
|
|
275
|
-
);
|
|
276
|
-
supertest(app)
|
|
277
|
-
.get("/static-with-mime-type")
|
|
278
|
-
.expect(
|
|
279
|
-
"Cache-Control",
|
|
280
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
281
|
-
)
|
|
282
|
-
.expect("Vary", /Accept\-Encoding/)
|
|
283
|
-
.expect("Surrogate-Key", "u/42/105")
|
|
284
|
-
.expect("Cache-Tag", "u/42/105")
|
|
285
|
-
.expect("Content-Type", "text/plain; charset=utf-8")
|
|
286
|
-
.expect(200, done);
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
it("Adds content type default if metadata in response is not set", function (done) {
|
|
290
|
-
const app = createApp(
|
|
291
|
-
(pageType, params, config, client, { next }) => next(),
|
|
292
|
-
[{ pageType: "story-page", path: "/*" }]
|
|
293
|
-
);
|
|
294
|
-
supertest(app)
|
|
295
|
-
.get("/static-without-header-footer")
|
|
296
|
-
.expect(
|
|
297
|
-
"Cache-Control",
|
|
298
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
299
|
-
)
|
|
300
|
-
.expect("Vary", "Accept-Encoding")
|
|
301
|
-
.expect("Surrogate-Key", "u/42/104")
|
|
302
|
-
.expect("Cache-Tag", "u/42/104")
|
|
303
|
-
.expect("Content-Type", "text/html; charset=utf-8")
|
|
304
|
-
.expect(200, done);
|
|
305
|
-
});
|
|
306
226
|
});
|