qumra-engine 2.0.48 → 2.0.50
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.
|
@@ -10,23 +10,32 @@ exports.default = new (class SeoExtension {
|
|
|
10
10
|
parser.advanceAfterBlockEnd(tok.value);
|
|
11
11
|
return new nodes.CallExtension(this, "run", null);
|
|
12
12
|
}
|
|
13
|
-
run({
|
|
14
|
-
const
|
|
13
|
+
run({ ctx }) {
|
|
14
|
+
const escapeHtml = (str) => String(str || "")
|
|
15
|
+
.replace(/&/g, "&")
|
|
16
|
+
.replace(/</g, "<")
|
|
17
|
+
.replace(/>/g, ">")
|
|
18
|
+
.replace(/"/g, """);
|
|
19
|
+
const seo = ctx.context.seo || {};
|
|
15
20
|
const page = ctx.context.page || {};
|
|
16
|
-
const
|
|
17
|
-
const pageUrl =
|
|
18
|
-
const pageTitle =
|
|
19
|
-
const pageDescription =
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
<title>${pageTitle}</title>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<meta property="og:title" content="${pageTitle}">
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
const store = ctx.context.store || {};
|
|
22
|
+
const pageUrl = seo.canonical || "";
|
|
23
|
+
const pageTitle = seo.title || page.title || "Store";
|
|
24
|
+
const pageDescription = seo.description || page.description || "";
|
|
25
|
+
const pageImage = seo.image || "";
|
|
26
|
+
const favicon = pageImage || "/favicon.ico"; // الأولوية للوجو
|
|
27
|
+
let tags = `
|
|
28
|
+
<title>${escapeHtml(pageTitle)}</title>
|
|
29
|
+
${favicon ? `<link rel="icon" type="image/png" href="${escapeHtml(favicon)}">` : ""}
|
|
30
|
+
${pageDescription ? `<meta name="description" content="${escapeHtml(pageDescription)}">` : ""}
|
|
31
|
+
${pageUrl ? `<link rel="canonical" href="${escapeHtml(pageUrl)}">` : ""}
|
|
32
|
+
<meta property="og:title" content="${escapeHtml(pageTitle)}">
|
|
33
|
+
${pageDescription ? `<meta property="og:description" content="${escapeHtml(pageDescription)}">` : ""}
|
|
34
|
+
${pageImage ? `<meta property="og:image" content="${escapeHtml(pageImage)}">` : ""}
|
|
35
|
+
${pageUrl ? `<meta property="og:url" content="${escapeHtml(pageUrl)}">` : ""}
|
|
36
|
+
<meta property="og:type" content="website">
|
|
37
|
+
${pageImage ? `<meta name="twitter:card" content="summary_large_image">` : `<meta name="twitter:card" content="summary">`}
|
|
38
|
+
`;
|
|
39
|
+
return new nunjucks_1.runtime.SafeString(tags.trim());
|
|
31
40
|
}
|
|
32
41
|
})();
|