first deployment of kikomiko with url photos
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
8d98304137
commit
ae3ed7c7b7
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
// Product-owned text is escaped; imported HTML is never executed.
|
||||
const esc = (value) =>
|
||||
String(value ?? "")
|
||||
.replaceAll("&", "&")
|
||||
.replaceAll("<", "<")
|
||||
.replaceAll(">", ">")
|
||||
.replaceAll('"', """);
|
||||
|
||||
/** Support note appended after every product description (links are trusted site URLs). */
|
||||
function descriptionHelpHtml() {
|
||||
return `<p class="product-description-help" lang="fa" dir="rtl">در صورت نیاز به اطلاعات بیشتر راجع به این محصول میتوانید به <a href="/contact/">پشتیبانی</a> کیکومیکو پیام دهید یا به وبسایت اصلی <a href="https://www.kikocosmetics.com/" target="_blank" rel="noopener noreferrer">کیکو</a> مراجعه فرمایید.</p>`;
|
||||
}
|
||||
|
||||
function descriptionHtml(description) {
|
||||
if (!description) return "";
|
||||
const [intro, ...rest] = String(description).split(/\n\s*\n/);
|
||||
return `<p class="text-muted product-description" lang="fa"><span data-product-description-intro>${esc(intro)}</span>${
|
||||
rest.length ? `\n\n${esc(rest.join("\n\n"))}` : ""
|
||||
}</p>${descriptionHelpHtml()}`;
|
||||
}
|
||||
|
||||
export function detailRows() {
|
||||
// Detail / facts tables are intentionally unused on the storefront.
|
||||
return [];
|
||||
}
|
||||
|
||||
export function renderProductContent(container, product, variant = {}) {
|
||||
const description =
|
||||
variant.description ||
|
||||
variant.descriptionIntro ||
|
||||
product.description ||
|
||||
product.descriptionIntro ||
|
||||
"";
|
||||
|
||||
if (container) {
|
||||
const descBlock = description
|
||||
? `<section class="pdp-section" aria-labelledby="product-desc-title">
|
||||
<h2 id="product-desc-title">معرفی و توضیحات محصول</h2>
|
||||
${descriptionHtml(description)}
|
||||
</section>`
|
||||
: `<section class="pdp-section" aria-labelledby="product-desc-title">
|
||||
<h2 id="product-desc-title">معرفی و توضیحات محصول</h2>
|
||||
${descriptionHelpHtml()}
|
||||
</section>`;
|
||||
|
||||
container.innerHTML = descBlock;
|
||||
}
|
||||
|
||||
document.title =
|
||||
variant.seoTitle ||
|
||||
product.seoTitle ||
|
||||
`${variant.name || product.name} | کیکومیکو`;
|
||||
const meta = document.querySelector('meta[name="description"]');
|
||||
if (meta) {
|
||||
meta.content =
|
||||
variant.seoDescription || product.seoDescription || description;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user