@quintype/framework 7.7.0 → 7.7.1-enable-amp-flag.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
|
@@ -34,22 +34,21 @@ async function ampStoryPageHandler(
|
|
|
34
34
|
ampLibrary = require("@quintype/amp"),
|
|
35
35
|
additionalConfig = require("../../publisher-config"),
|
|
36
36
|
InfiniteScrollAmp = require("../helpers/infinite-scroll"),
|
|
37
|
+
isVisualStory = false,
|
|
37
38
|
...rest
|
|
38
39
|
}
|
|
39
40
|
) {
|
|
40
41
|
try {
|
|
41
42
|
const opts = cloneDeep(rest);
|
|
42
|
-
|
|
43
43
|
const redirectUrls = opts && opts.redirectUrls;
|
|
44
44
|
const getEnableAmp = get(opts, ["enableAmp"], true);
|
|
45
|
-
|
|
46
45
|
const enableAmp = typeof getEnableAmp === "function" ? opts.enableAmp(config) : getEnableAmp;
|
|
47
46
|
|
|
48
47
|
if (typeof redirectUrls === "function" || (redirectUrls && Object.keys(redirectUrls).length > 0)) {
|
|
49
48
|
await getRedirectUrl(req, res, next, { redirectUrls, config });
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
if (!enableAmp) {
|
|
51
|
+
if (!isVisualStory && !enableAmp) {
|
|
53
52
|
return res.redirect(301, `/${req.params[0]}`);
|
|
54
53
|
}
|
|
55
54
|
|
package/server/routes.js
CHANGED
|
@@ -630,5 +630,5 @@ exports.ampRoutes = (app, opts = {}) => {
|
|
|
630
630
|
getWithConfig(app, "/amp/story/*", ampStoryPageHandler, opts);
|
|
631
631
|
getWithConfig(app, "/amp/api/v1/amp-infinite-scroll", storyPageInfiniteScrollHandler, opts);
|
|
632
632
|
getWithConfig(app, "/amp/api/v1/bookend.json", bookendHandler, opts);
|
|
633
|
-
getWithConfig(app, "/ampstories/*", ampStoryPageHandler, opts);
|
|
633
|
+
getWithConfig(app, "/ampstories/*", ampStoryPageHandler, { ...opts, isVisualStory: true });
|
|
634
634
|
};
|