Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tqlg 307 seo img alt title #111

Merged
merged 16 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/Account/Order/AccountOrderConfirmPayment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ onMounted(async () => {
label: method.translated.name,
value: method.id,
description: method.translated.description,
mediaUrl: method.media?.url,
media: method.media,
}));
});
</script>
Expand All @@ -48,7 +48,7 @@ onMounted(async () => {
<CheckoutConfirmPaymentMethod
:label="option.label"
:description="option.description"
:media-url="option.mediaUrl"
:media="option.media"
/>
</template>
</FormKit>
Expand Down
2 changes: 1 addition & 1 deletion components/Account/Order/AccountOrderConfirmShipping.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defineProps<{
:label="getTranslatedProperty(method, 'name')"
:delivery-time="getShippingMethodDeliveryTime(method)"
:description="getTranslatedProperty(method, 'description')"
:media-url="method.media?.url"
:media="method.media"
/>
</template>
</CheckoutConfirmCard>
Expand Down
8 changes: 6 additions & 2 deletions components/Checkout/CheckoutLineItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ const debounceUpdate = useDebounceFn(updateQuantity, 600);
<template v-else>
<img
:src="lineItemCover.url"
:alt="lineItemCover.alt"
:alt="lineItemCover.alt ?? lineItem?.translated?.name ?? product?.translated?.name"
:title="lineItemCover.title ?? lineItem?.translated?.name ?? product?.translated?.name"
class="h-full w-full object-cover object-center"
/>
</template>
</LocaleLink>

<div
v-else-if="isPromotion"
class="flex h-full w-full items-center justify-center"
Expand All @@ -139,7 +141,9 @@ const debounceUpdate = useDebounceFn(updateQuantity, 600);
</span>
</div>

<span v-if="isDigital">{{ $t('checkout.lineItem.digitalProduct') }}</span>
<span v-if="isDigital">
{{ $t('checkout.lineItem.digitalProduct') }}
</span>

<p
v-if="itemOptions"
Expand Down
5 changes: 3 additions & 2 deletions components/Checkout/Confirm/CheckoutConfirmPayment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ onMounted(async () => {
label: method.translated.name,
value: method.id,
description: method.translated.description,
mediaUrl: method.media?.url,
media: method.media,
}));

trackAddPaymentInfo();
});
</script>
Expand All @@ -49,7 +50,7 @@ onMounted(async () => {
<CheckoutConfirmPaymentMethod
:label="option.label"
:description="option.description"
:media-url="option.mediaUrl"
:media="option.media"
/>
</template>
</FormKit>
Expand Down
12 changes: 8 additions & 4 deletions components/Checkout/Confirm/CheckoutConfirmPaymentMethod.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script setup lang="ts">
import type { Schemas } from "@shopware/api-client/api-types";

defineProps<{
label: string;
description?: string;
mediaUrl?: string;
media?: Schemas['Media'];
}>();
</script>

Expand All @@ -19,11 +21,13 @@ defineProps<{
{{ description }}
</span>
</div>

<img
v-if="mediaUrl"
v-if="media"
loading="lazy"
:src="mediaUrl"
:alt="`Logo of ${label}`"
:src="media.url"
:alt="media.translated?.alt"
:title="media.translated?.title"
class="ml-auto max-h-6 max-w-full object-contain"
/>
</template>
4 changes: 2 additions & 2 deletions components/Checkout/Confirm/CheckoutConfirmShipping.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ onMounted(async () => {
value: method.id,
deliveryTime: getShippingMethodDeliveryTime(method),
description: method.translated.description,
mediaUrl: method.media?.url,
media: method.media,
}));

trackAddShippingInfo();
Expand All @@ -51,7 +51,7 @@ onMounted(async () => {
:label="option.label"
:delivery-time="option.deliveryTime"
:description="option.description"
:media-url="option.mediaUrl"
:media="option.media"
/>
</template>
</FormKit>
Expand Down
11 changes: 7 additions & 4 deletions components/Checkout/Confirm/CheckoutConfirmShippingMethod.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script setup lang="ts">
import type { Schemas } from "@shopware/api-client/api-types";

defineProps<{
label: string;
deliveryTime?: string;
description?: string;
mediaUrl?: string;
media?: Schemas['Media'];
}>();
</script>

Expand All @@ -23,10 +25,11 @@ defineProps<{
</span>

<img
v-if="mediaUrl"
v-if="media"
loading="lazy"
:src="mediaUrl"
:alt="`Logo of ${label}`"
:src="media.url"
:alt="media.translated?.alt"
:title="media.translated?.title"
/>
</div>
</template>
4 changes: 3 additions & 1 deletion components/Cms/Element/CmsElementImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const getMinHeightAsHeight = (properties: CSSProperties) => {
/>
{{ $t('cms.element.videoTagNotSupported') }}
</video>

<img
v-else
ref="imageElement"
Expand All @@ -62,7 +63,8 @@ const getMinHeightAsHeight = (properties: CSSProperties) => {
'object-cover': displayMode === 'cover',
}"
:style="displayMode === 'cover' ? getMinHeightAsHeight(containerStyle) : ''"
:alt="imageAttrs.alt"
:alt="props.element?.data?.media?.translated?.alt"
:title="props.element?.data?.media?.translated?.title"
:src="srcPath"
:srcset="imageAttrs.srcset"
/>
Expand Down
6 changes: 4 additions & 2 deletions components/Cms/Element/CmsElementImageGallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const slides = elementData.getData('sliderItems') ?? [];
<img
v-if="slide.media.url"
:src="slide.media.url"
:alt="slide.translated?.alt ?? $t('cms.element.imageAlt')"
:alt="slide.media.translated?.alt ?? $t('cms.element.imageAlt')"
:title="slide.media.translated?.title ?? $t('cms.element.imageAlt')"
class="h-full w-full object-center"
:class="'object-' + displayMode"
/>
Expand Down Expand Up @@ -78,7 +79,8 @@ const slides = elementData.getData('sliderItems') ?? [];
<img
v-if="slide.media.url"
:src="slide.media.url"
:alt="slide.translated?.alt ?? $t('cms.element.imageAlt')"
:alt="slide.media.translated?.alt ?? $t('cms.element.imageAlt')"
:title="slide.media.translated?.title ?? $t('cms.element.imageAlt')"
class="object-cover object-center opacity-40 group-[.swiper-slide-thumb-active]:border-2 group-[.swiper-slide-thumb-active]:border-brand-primary group-[.swiper-slide-thumb-active]:opacity-100"
/>

Expand Down
9 changes: 5 additions & 4 deletions components/Cms/Element/CmsElementImageSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const autoplayTimeout = config.getConfigValue('autoplayTimeout');
const minHeight = config.getConfigValue('minHeight');
const speed = config.getConfigValue('speed');

const slides = computed(() => config.getConfigValue('sliderItems') ?? []);
const slides = computed(() => data.getData('sliderItems') ?? []);
const sliderRef = ref(null);

if (slides.value.length > 0) {
Expand Down Expand Up @@ -92,13 +92,14 @@ if (isHomePage.value) {
>
<LayoutSliderSlide
v-for="slide in slides"
:key="slide.mediaId"
:key="slide.media.id"
:class="`min-h-[${minHeight}]`"
>
<img
ref="slidesRef"
:src="slide.mediaUrl"
:alt="$t('cms.element.imageAlt')"
:src="slide.media.url"
:alt="slide.media?.translated?.alt ?? $t('cms.element.imageAlt')"
:title="slide.media?.translated?.title ?? $t('cms.element.imageAlt')"
class="h-full w-full object-center"
:class="'object-' + displayMode"
/>
Expand Down
6 changes: 3 additions & 3 deletions components/Layout/Footer/LayoutFooterPaymentMethods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ onMounted(async () => {
<img
v-if="method.media?.url"
:src="method.media.url"
:alt="getTranslatedProperty(method, 'name')"
:title="getTranslatedProperty(method, 'name')"
:alt="method.media.translated.alt ?? getTranslatedProperty(method, 'name')"
:title="method.media.translated.title ?? getTranslatedProperty(method, 'name')"
class="h-8 w-auto object-contain"
loading="eager"
loading="lazy"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const productCover = getProductCover(props.product.cover, 'xs');
loading="lazy"
:src="productCover.url"
class="h-10 min-h-10 w-10 min-w-10 object-cover"
:alt="productCover.alt"
:alt="productCover.alt ?? product?.translated?.name"
:title="productCover.title ?? product?.translated?.name"
/>
</template>
</div>
Expand Down
7 changes: 6 additions & 1 deletion components/Layout/LayoutLogo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,23 @@ const shopName = configStore.get('core.basicInformation.shopName') ?? 'pond';
:title="shopName"
:to="withLink ? '/' : ''"
>
<span class="sr-only">{{ shopName }}</span>
<span class="sr-only">
{{ shopName }}
</span>

<img
v-if="!smallLogo"
src="/logo.svg"
:alt="shopName"
:title="shopName"
:class="logoClasses"
/>

<img
v-else
src="/logo-small.svg"
:alt="shopName"
:title="shopName"
:class="logoClasses"
/>
</LocaleLink>
Expand Down
3 changes: 2 additions & 1 deletion components/Order/OrderLineItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const lineItemCover = getProductCover(lineItem.value.cover, 'xs');
<template v-else>
<img
:src="lineItemCover.url"
:alt="lineItemCover.alt"
:alt="lineItemCover.alt ?? lineItem?.translated?.name"
:title="lineItemCover.title ?? lineItem?.translated?.name"
m-borgmann marked this conversation as resolved.
Show resolved Hide resolved
class="h-full w-full object-cover object-center"
/>
</template>
Expand Down
3 changes: 2 additions & 1 deletion components/Product/ProductCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const { stop } = useIntersectionObserver(productCard, ([{ isIntersecting }]) =>
<template v-else>
<img
:src="cover.url"
:alt="cover.alt"
:alt="cover.alt ?? props.product.translated.name"
:title="cover.title ?? props.product.translated.name"
class="aspect-square h-full w-full object-center group-hover:opacity-75"
:class="displayMode === 'standard' ? 'object-scale-down' : 'object-' + displayMode"
/>
Expand Down
7 changes: 2 additions & 5 deletions components/Product/ProductVariantSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,8 @@ const { entityArrayToOptions } = useFormkitHelper();
>
<img
:src="option.media.url"
:alt="
getTranslatedProperty(option.media, 'alt') ??
getTranslatedProperty(option.media, 'title') ??
option.media.fileName
"
:alt="option.media.translated.alt ?? option.media.fileName"
:title="option.media.translated.title ?? option.media.fileName"
class="rounded-full"
/>
</FormKit>
Expand Down
7 changes: 5 additions & 2 deletions composables/useMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function useMedia() {
return {
url: '/fallback-product-cover.svg',
alt: t('composable.media.noImageMessage'),
title: t('composable.media.noImageMessage'),
placeholder: true,
};
}
Expand All @@ -43,13 +44,15 @@ export function useMedia() {
url: cover.media.thumbnails?.length
? cover.media.thumbnails[thumbnailSizes[size]]?.url
: cover.media.url,
alt: cover.media.alt,
alt: cover.media.translated.alt,
title: cover.media.translated.title,
placeholder: false,
};
} else {
return {
url: cover.thumbnails?.length ? cover.thumbnails[thumbnailSizes[size]]?.url : cover.url,
alt: cover.alt,
alt: cover.translated.alt,
title: cover.translated.title,
placeholder: false,
};
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@basecom-gmbh/pond",
"type": "module",
"main": "./nuxt.config.ts",
"version": "0.0.24",
"version": "0.0.25",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
Expand Down