basklee-nuxt 0.9.8 → 0.9.9
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/README.md
CHANGED
|
@@ -515,6 +515,7 @@ fields. Empty values fall back to page-specific Russian, Spanish or English copy
|
|
|
515
515
|
route data. The homepage retains additional backend Open Graph and Twitter tags
|
|
516
516
|
through `useHead()`. Profile and logout pages remain excluded from indexing;
|
|
517
517
|
search results retain their `noindex, follow` policy.
|
|
518
|
+
A product page takes the product's SEO tab: its heading is the page title (the product name without one), its meta description and keywords fill their tags, and its own Open Graph and Twitter Cards tags are added in the page's language only, replacing a default tag of the same name.
|
|
518
519
|
Pages with a canonical address also link the same page in the other storefront languages (`hreflang`) and set `og:type` and `og:locale`; a journal article adds its publication date (`article:published_time`) and schema.org `BlogPosting` data. The store icon (`logos.ico`) is the page's `<link rel="icon">`. An unknown `?locale` opens the default language.
|
|
519
520
|
|
|
520
521
|
List pages (journal, categories, stores) link their previous and next pages as real links (`?page=2`). Each later page has its own canonical address and a title with its page number; a journal page past the last one answers 404.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basklee-nuxt",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "Nuxt 4 storefront for your Basklee marketplace: setup CLI, server API gateway, typed store and ready-made catalog, cart, checkout and account components in English, Russian and Spanish, plus an Android app build. Powered by Basklee: https://basklee.com",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
storefrontPublicOrigin,
|
|
14
14
|
} from '@/utils/basklee/pageSeo';
|
|
15
15
|
import type { StorefrontSeoPage } from '@/utils/basklee/pageSeo';
|
|
16
|
+
import type { StorefrontSeoMeta } from '@/utils/basklee/seo';
|
|
16
17
|
import { structuredDataJson } from '@/utils/basklee/productStructuredData';
|
|
17
18
|
|
|
18
19
|
export function useBaskleePageSeo(
|
|
@@ -33,6 +34,12 @@ export function useBaskleePageSeo(
|
|
|
33
34
|
* canonical address (preview, filtered, noindex) gets none.
|
|
34
35
|
*/
|
|
35
36
|
structuredData?: (canonical: string, origin: string) => unknown;
|
|
37
|
+
/**
|
|
38
|
+
* The record's own tags (a product's Open Graph and Twitter Cards tags
|
|
39
|
+
* from the panel's SEO tab). They are said after the page's own tags,
|
|
40
|
+
* so a tag of the same name (og:title, og:description) replaces it.
|
|
41
|
+
*/
|
|
42
|
+
meta?: MaybeRefOrGetter<StorefrontSeoMeta[] | undefined>;
|
|
36
43
|
} = {},
|
|
37
44
|
) {
|
|
38
45
|
const route = useRoute();
|
|
@@ -106,6 +113,13 @@ export function useBaskleePageSeo(
|
|
|
106
113
|
: '',
|
|
107
114
|
);
|
|
108
115
|
useSeoMeta(seo);
|
|
116
|
+
useHead({
|
|
117
|
+
meta: () =>
|
|
118
|
+
(toValue(values.meta) ?? []).map((tag) => ({
|
|
119
|
+
key: 'property' in tag ? tag.property : tag.name,
|
|
120
|
+
...tag,
|
|
121
|
+
})),
|
|
122
|
+
});
|
|
109
123
|
useHead({
|
|
110
124
|
link: () =>
|
|
111
125
|
canonical.value
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IDomainSeoOg,
|
|
3
|
+
IDomainSeoTwitter,
|
|
4
|
+
} from '@/interfaces/basklee/appBase/appLoadCommon/IAppLoadCommonSEO';
|
|
1
5
|
import type { ITransformValue } from '@/interfaces/basklee/shared/ITransformValue';
|
|
2
6
|
|
|
3
7
|
export interface IProduct {
|
|
8
|
+
/** The product's own Open Graph / Twitter Cards tags (single product only). */
|
|
9
|
+
og?: IDomainSeoOg[];
|
|
10
|
+
twitter?: IDomainSeoTwitter[];
|
|
4
11
|
id: number;
|
|
5
12
|
product_group_id: number;
|
|
6
13
|
whishlist_id?: number | null;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { computed, ref, watch } from 'vue';
|
|
4
4
|
import { navigateTo, useRoute } from '#imports';
|
|
5
5
|
import { useBaskleePageSeo } from '@/composables/useBaskleePageSeo';
|
|
6
|
+
import { getProductSocialMeta } from '@/utils/basklee/seo';
|
|
6
7
|
import { useBaskleeMissingPage } from '@/composables/useBaskleeMissingPage';
|
|
7
8
|
import { useBaskleeServerData } from '@/composables/useBaskleeServerData';
|
|
8
9
|
import { requestProductPage } from '@/utils/basklee/productPage';
|
|
@@ -94,9 +95,22 @@
|
|
|
94
95
|
).slice(0, 160),
|
|
95
96
|
);
|
|
96
97
|
|
|
98
|
+
// The panel's SEO tab: its heading is the page title and its keywords the
|
|
99
|
+
// keywords tag; without them the product's name and the page's own words.
|
|
100
|
+
const productSeo = (key: 'product_title' | 'meta_keywords') =>
|
|
101
|
+
plainText(
|
|
102
|
+
getAvailableNestedValueFromObject(
|
|
103
|
+
product.value?.locale,
|
|
104
|
+
store.localeCode,
|
|
105
|
+
key,
|
|
106
|
+
),
|
|
107
|
+
);
|
|
108
|
+
|
|
97
109
|
useBaskleePageSeo('product', () => store.localeCode, {
|
|
98
|
-
title: () => productName.value,
|
|
110
|
+
title: () => productSeo('product_title') || productName.value,
|
|
99
111
|
description: () => productSummary.value,
|
|
112
|
+
keywords: () => productSeo('meta_keywords') || undefined,
|
|
113
|
+
meta: () => getProductSocialMeta(product.value, store.localeCode),
|
|
100
114
|
image: () => image.value,
|
|
101
115
|
robots: () =>
|
|
102
116
|
previewKey.value ? 'noindex, nofollow' : undefined,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IAppLoadCommonSeo } from '@/interfaces/basklee/appBase/appLoadCommon/IAppLoadCommonSEO';
|
|
2
2
|
import { getAvailableNestedValueFromObject } from '@/utils/basklee/presentation';
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
export type StorefrontSeoMeta =
|
|
5
5
|
{ name: string; content: string } | { property: string; content: string };
|
|
6
|
+
type SeoMeta = StorefrontSeoMeta;
|
|
6
7
|
|
|
7
8
|
export function getStorefrontSeo(
|
|
8
9
|
incomingData: IAppLoadCommonSeo[],
|
|
@@ -50,3 +51,28 @@ export function getStorefrontSeo(
|
|
|
50
51
|
}
|
|
51
52
|
return { title, meta };
|
|
52
53
|
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A product's own Open Graph and Twitter Cards tags (the panel's SEO tab) for
|
|
57
|
+
* its page head. Only the page's own language counts: a tag written in English
|
|
58
|
+
* is left out of the Russian page rather than replacing its Russian title.
|
|
59
|
+
*/
|
|
60
|
+
export function getProductSocialMeta(
|
|
61
|
+
product: Partial<Pick<IAppLoadCommonSeo, 'og' | 'twitter'>> | undefined,
|
|
62
|
+
locale: string,
|
|
63
|
+
): StorefrontSeoMeta[] {
|
|
64
|
+
const meta: StorefrontSeoMeta[] = [];
|
|
65
|
+
for (const tag of product?.og ?? []) {
|
|
66
|
+
const content = tag.locale?.[locale]?.og_content_value?.trim();
|
|
67
|
+
if (content) {
|
|
68
|
+
meta.push({ property: tag.og_property_name, content });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (const tag of product?.twitter ?? []) {
|
|
72
|
+
const content = tag.locale?.[locale]?.extra_meta_content?.trim();
|
|
73
|
+
if (content) {
|
|
74
|
+
meta.push({ name: tag.extra_meta_name, content });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return meta;
|
|
78
|
+
}
|