qumra-engine 2.0.141 → 2.0.143
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.
|
@@ -24,9 +24,12 @@ exports.default = new (class SeoExtension {
|
|
|
24
24
|
const product = page.product || c.product || {};
|
|
25
25
|
// أساسيات
|
|
26
26
|
const siteName = (0, textOnly_1.textOnly)(store?.name || "Store", 70);
|
|
27
|
+
console.log("🚀 ~ run ~ seo.title:", seo.title);
|
|
27
28
|
const titleRaw = seo.title || page.title || siteName;
|
|
29
|
+
console.log("🚀 ~ run ~ titleRaw:", titleRaw);
|
|
28
30
|
const descRaw = seo.description || page.description || "";
|
|
29
31
|
const pageTitle = (0, textOnly_1.textOnly)(titleRaw, 70);
|
|
32
|
+
console.log("🚀 ~ run ~ pageTitle:", pageTitle);
|
|
30
33
|
const pageDesc = (0, textOnly_1.textOnly)(descRaw, 160);
|
|
31
34
|
// روابط وصور
|
|
32
35
|
const canonical = (0, safeUrl_1.safeUrl)(seo.canonical || page.canonical || page.url || "");
|
|
@@ -63,6 +66,8 @@ exports.default = new (class SeoExtension {
|
|
|
63
66
|
// بناء الوسوم
|
|
64
67
|
const parts = [];
|
|
65
68
|
// Title + Canonical + Favicon + Description
|
|
69
|
+
parts.push(`<meta charset="utf-8">`);
|
|
70
|
+
parts.push(`<meta name="viewport" content="width=device-width, initial-scale=1">`);
|
|
66
71
|
parts.push(`<title>${(0, escapeAttr_1.escapeAttr)(pageTitle)}</title>`);
|
|
67
72
|
if (canonical)
|
|
68
73
|
parts.push(`<link rel="canonical" href="${(0, escapeAttr_1.escapeAttr)(canonical)}">`);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
2
|
export declare const mergeDataMiddleware: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
@@ -4,47 +4,52 @@ exports.mergeDataMiddleware = void 0;
|
|
|
4
4
|
const globals_1 = require("../store/globals");
|
|
5
5
|
const mergeDataMiddleware = async (req, res, next) => {
|
|
6
6
|
try {
|
|
7
|
-
if ((res.locals.preview && res.locals.themeWidget) ||
|
|
8
|
-
res.locals.env.addGlobal(
|
|
7
|
+
if ((res.locals.preview && res.locals.themeWidget) || req.query.widgetId) {
|
|
8
|
+
res.locals.env.addGlobal('widget', res.locals.render.engine?.widget ?? []);
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
11
|
-
res.locals.env.addGlobal(
|
|
11
|
+
res.locals.env.addGlobal('widget', null);
|
|
12
12
|
}
|
|
13
13
|
const widgets = res.locals.render.engine?.page?.widgets ?? [];
|
|
14
|
-
(0, globals_1.setGlobal)(
|
|
14
|
+
(0, globals_1.setGlobal)('currency', res.locals.render.globals?.currency);
|
|
15
15
|
if (res.locals.isIframe) {
|
|
16
|
-
res.locals.env.addGlobal(
|
|
16
|
+
res.locals.env.addGlobal('isIframe', res.locals.isIframe);
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
|
-
res.locals.env.addGlobal(
|
|
19
|
+
res.locals.env.addGlobal('isIframe', false);
|
|
20
20
|
}
|
|
21
21
|
if (res.locals.showDevTools) {
|
|
22
|
-
res.locals.env.addGlobal(
|
|
22
|
+
res.locals.env.addGlobal('showDevTools', res.locals.showDevTools);
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
|
-
res.locals.env.addGlobal(
|
|
25
|
+
res.locals.env.addGlobal('showDevTools', false);
|
|
26
26
|
}
|
|
27
|
-
res.locals.env.addGlobal(
|
|
28
|
-
res.locals.env.addGlobal(
|
|
29
|
-
res.locals.env.addGlobal(
|
|
30
|
-
res.locals.env.addGlobal(
|
|
27
|
+
res.locals.env.addGlobal('templates', res.locals.render.engine?.templates);
|
|
28
|
+
res.locals.env.addGlobal('engineData', res.locals.render.engine);
|
|
29
|
+
res.locals.env.addGlobal('widgets', widgets);
|
|
30
|
+
res.locals.env.addGlobal('pageData', {
|
|
31
31
|
layout: res.locals.render.engine?.page?.layout,
|
|
32
32
|
title: res.locals.render.engine?.page?.title,
|
|
33
33
|
handle: res.locals.render.engine?.page?.handle,
|
|
34
34
|
});
|
|
35
35
|
const settingsData = res.locals.render.engine?.settings;
|
|
36
|
-
res.locals.env.addGlobal(
|
|
36
|
+
res.locals.env.addGlobal('settings', settingsData);
|
|
37
37
|
if (res.locals.render.globals?.themeVersion) {
|
|
38
|
-
res.locals.env.addGlobal(
|
|
38
|
+
res.locals.env.addGlobal('themeVersion', res.locals.render.globals?.themeVersion);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
res.locals.env.addGlobal(
|
|
41
|
+
res.locals.env.addGlobal('themeVersion', false);
|
|
42
|
+
}
|
|
43
|
+
if (res.locals.render.globals?.themeDevMode) {
|
|
44
|
+
res.locals.env.addGlobal('themeDevMode', res.locals.render.globals?.themeDevMode);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
res.locals.env.addGlobal('themeDevMode', false);
|
|
42
48
|
}
|
|
43
|
-
res.locals.env.addGlobal("themeDevMode", res.locals.render.globals?.themeDevMode);
|
|
44
49
|
next();
|
|
45
50
|
}
|
|
46
51
|
catch (err) {
|
|
47
|
-
console.error(
|
|
52
|
+
console.error('❌ mergeDataMiddleware error:', err);
|
|
48
53
|
return next(err);
|
|
49
54
|
}
|
|
50
55
|
};
|