core-maugli 1.2.24 → 1.2.25
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 +1 -1
- package/src/components/Card.astro +25 -3
package/package.json
CHANGED
@@ -20,10 +20,20 @@ const { href, title, image, seo, publishDate, excerpt, description, headingLevel
|
|
20
20
|
|
21
21
|
const TitleTag = headingLevel;
|
22
22
|
|
23
|
+
// Отладка: проверяем, что именно приходит в image
|
24
|
+
console.log('Card.astro DEBUG:', {
|
25
|
+
type: typeof image,
|
26
|
+
value: image,
|
27
|
+
src: image?.src,
|
28
|
+
isObject: typeof image === 'object',
|
29
|
+
isString: typeof image === 'string'
|
30
|
+
});
|
31
|
+
|
23
32
|
// Определяем базовое изображение для карточки
|
24
|
-
|
33
|
+
// Убеждаемся, что получаем только строку пути, а не объект asset
|
34
|
+
let baseImage =
|
25
35
|
seo?.image?.src ||
|
26
|
-
(image && typeof image
|
36
|
+
(image && typeof image === 'object' && image.src ? image.src : image && typeof image === 'string' ? image : undefined) ||
|
27
37
|
(type === 'blog'
|
28
38
|
? maugliConfig.defaultBlogImage
|
29
39
|
: type === 'project'
|
@@ -32,7 +42,19 @@ const baseImage =
|
|
32
42
|
? maugliConfig.defaultProductImage
|
33
43
|
: maugliConfig.seo.defaultImage);
|
34
44
|
|
35
|
-
|
45
|
+
// Убеждаемся, что baseImage - это строка, а не asset объект
|
46
|
+
if (baseImage && typeof baseImage === 'object' && baseImage.src) {
|
47
|
+
baseImage = baseImage.src;
|
48
|
+
}
|
49
|
+
|
50
|
+
// Убираем ведущий слэш, чтобы избежать обработки через asset pipeline
|
51
|
+
if (baseImage && baseImage.startsWith('/')) {
|
52
|
+
baseImage = baseImage.substring(1);
|
53
|
+
}
|
54
|
+
|
55
|
+
console.log('Card.astro baseImage:', baseImage);
|
56
|
+
|
57
|
+
const cardImageAlt = seo?.image?.alt || (image && typeof image === 'object' ? image.alt : undefined) || title || 'Изображение';
|
36
58
|
|
37
59
|
// Определяем контент для отображения
|
38
60
|
const content = excerpt || description;
|