@umituz/web-seo 2.0.4 → 2.0.6
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/dist/domains/seo/components/index.d.ts +8 -0
- package/dist/domains/seo/components/index.d.ts.map +1 -0
- package/dist/domains/seo/components/index.js +7 -0
- package/dist/domains/seo/hooks/index.d.ts +8 -0
- package/dist/domains/seo/hooks/index.d.ts.map +1 -0
- package/dist/domains/seo/hooks/index.js +7 -0
- package/dist/domains/seo/ssr/renderer.d.ts +1 -1
- package/dist/domains/seo/ssr/renderer.d.ts.map +1 -1
- package/dist/domains/seo/types/index.d.ts +5 -1
- package/dist/domains/seo/types/index.d.ts.map +1 -1
- package/dist/domains/seo/utils/dom.d.ts +5 -3
- package/dist/domains/seo/utils/dom.d.ts.map +1 -1
- package/dist/domains/seo/utils/dom.js +9 -322
- package/dist/domains/seo/utils/index.d.ts +10 -0
- package/dist/domains/seo/utils/index.d.ts.map +1 -0
- package/dist/domains/seo/utils/index.js +13 -0
- package/dist/domains/seo/utils/meta-tags/advanced.d.ts +31 -0
- package/dist/domains/seo/utils/meta-tags/advanced.d.ts.map +1 -0
- package/dist/domains/seo/utils/meta-tags/advanced.js +75 -0
- package/dist/domains/seo/utils/meta-tags/basic.d.ts +19 -0
- package/dist/domains/seo/utils/meta-tags/basic.d.ts.map +1 -0
- package/dist/domains/seo/utils/meta-tags/basic.js +93 -0
- package/dist/domains/seo/utils/meta-tags/index.d.ts +10 -0
- package/dist/domains/seo/utils/meta-tags/index.d.ts.map +1 -0
- package/dist/domains/seo/utils/meta-tags/index.js +9 -0
- package/dist/domains/seo/utils/meta-tags/performance.d.ts +19 -0
- package/dist/domains/seo/utils/meta-tags/performance.d.ts.map +1 -0
- package/dist/domains/seo/utils/meta-tags/performance.js +63 -0
- package/dist/domains/seo/utils/meta-tags/social.d.ts +15 -0
- package/dist/domains/seo/utils/meta-tags/social.d.ts.map +1 -0
- package/dist/domains/seo/utils/meta-tags/social.js +132 -0
- package/dist/domains/seo/utils/schema-generators/index.d.ts +7 -0
- package/dist/domains/seo/utils/schema-generators/index.d.ts.map +1 -0
- package/dist/domains/seo/utils/schema-generators/index.js +6 -0
- package/dist/domains/seo/utils/schema-generators/schema.d.ts +135 -0
- package/dist/domains/seo/utils/schema-generators/schema.d.ts.map +1 -0
- package/dist/domains/seo/utils/schema-generators/schema.js +321 -0
- package/dist/domains/seo/utils/validation/index.d.ts +7 -0
- package/dist/domains/seo/utils/validation/index.d.ts.map +1 -0
- package/dist/domains/seo/utils/validation/index.js +6 -0
- package/dist/domains/seo/utils/validation/validators.d.ts +39 -0
- package/dist/domains/seo/utils/validation/validators.d.ts.map +1 -0
- package/dist/domains/seo/utils/validation/validators.js +364 -0
- package/dist/domains/seo/vite/index.d.ts +8 -0
- package/dist/domains/seo/vite/index.d.ts.map +1 -0
- package/dist/domains/seo/vite/index.js +6 -0
- package/dist/domains/seo/vite/plugin.d.ts.map +1 -1
- package/dist/domains/seo/vite/plugin.js +6 -4
- package/dist/index.d.ts +13 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -4
- package/package.json +24 -3
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic Meta Tag Operations
|
|
3
|
+
*
|
|
4
|
+
* Core functions for setting meta and link tags
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Set a meta tag attribute
|
|
8
|
+
*/
|
|
9
|
+
export const setMetaTag = (attrName, attrValue, content) => {
|
|
10
|
+
if (typeof document === "undefined")
|
|
11
|
+
return;
|
|
12
|
+
let element = document.querySelector(`meta[${attrName}="${attrValue}"]`);
|
|
13
|
+
if (!element) {
|
|
14
|
+
element = document.createElement("meta");
|
|
15
|
+
element.setAttribute(attrName, attrValue);
|
|
16
|
+
document.head.appendChild(element);
|
|
17
|
+
}
|
|
18
|
+
if (content) {
|
|
19
|
+
element.setAttribute("content", content);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Set a link tag attribute
|
|
24
|
+
*/
|
|
25
|
+
export const setLinkTag = (attrs) => {
|
|
26
|
+
if (typeof document === "undefined")
|
|
27
|
+
return;
|
|
28
|
+
const rel = attrs.rel;
|
|
29
|
+
if (!rel)
|
|
30
|
+
return;
|
|
31
|
+
// Build selector based on rel and other identifying attributes
|
|
32
|
+
let selector = `link[rel="${rel}"]`;
|
|
33
|
+
if (attrs.href)
|
|
34
|
+
selector += `[href="${attrs.href}"]`;
|
|
35
|
+
if (attrs.sizes)
|
|
36
|
+
selector += `[sizes="${attrs.sizes}"]`;
|
|
37
|
+
if (attrs.type)
|
|
38
|
+
selector += `[type="${attrs.type}"]`;
|
|
39
|
+
let element = document.querySelector(selector);
|
|
40
|
+
if (!element) {
|
|
41
|
+
element = document.createElement("link");
|
|
42
|
+
document.head.appendChild(element);
|
|
43
|
+
}
|
|
44
|
+
Object.entries(attrs).forEach(([key, value]) => {
|
|
45
|
+
element.setAttribute(key, value);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Set robots meta tag
|
|
50
|
+
*/
|
|
51
|
+
export const setRobotsMeta = (robots) => {
|
|
52
|
+
if (typeof document === "undefined")
|
|
53
|
+
return;
|
|
54
|
+
let content = "";
|
|
55
|
+
if (typeof robots === "boolean") {
|
|
56
|
+
content = robots ? "index, follow" : "noindex, nofollow";
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const directives = [];
|
|
60
|
+
if (robots.index !== undefined) {
|
|
61
|
+
directives.push(robots.index ? "index" : "noindex");
|
|
62
|
+
}
|
|
63
|
+
if (robots.follow !== undefined) {
|
|
64
|
+
directives.push(robots.follow ? "follow" : "nofollow");
|
|
65
|
+
}
|
|
66
|
+
if (robots.archive !== undefined) {
|
|
67
|
+
directives.push(robots.archive ? "all" : "noarchive");
|
|
68
|
+
}
|
|
69
|
+
if (robots.snippet !== undefined) {
|
|
70
|
+
directives.push(robots.snippet ? "all" : "nosnippet");
|
|
71
|
+
}
|
|
72
|
+
if (robots.translate !== undefined) {
|
|
73
|
+
directives.push(robots.translate ? "all" : "notranslate");
|
|
74
|
+
}
|
|
75
|
+
if (robots.imageIndex !== undefined) {
|
|
76
|
+
directives.push(robots.imageIndex ? "all" : "noimageindex");
|
|
77
|
+
}
|
|
78
|
+
if (robots.maxSnippet !== undefined) {
|
|
79
|
+
directives.push(`max-snippet:${robots.maxSnippet}`);
|
|
80
|
+
}
|
|
81
|
+
if (robots.maxImagePreview !== undefined) {
|
|
82
|
+
directives.push(`max-image-preview:${robots.maxImagePreview}`);
|
|
83
|
+
}
|
|
84
|
+
if (robots.maxVideoPreview !== undefined) {
|
|
85
|
+
directives.push(`max-video-preview:${robots.maxVideoPreview}`);
|
|
86
|
+
}
|
|
87
|
+
if (robots.unavailableAfter !== undefined) {
|
|
88
|
+
directives.push(`unavailable_after:${robots.unavailableAfter}`);
|
|
89
|
+
}
|
|
90
|
+
content = directives.join(", ");
|
|
91
|
+
}
|
|
92
|
+
setMetaTag("name", "robots", content);
|
|
93
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta Tags Module
|
|
3
|
+
*
|
|
4
|
+
* All meta tag related utilities
|
|
5
|
+
*/
|
|
6
|
+
export { setMetaTag, setLinkTag, setRobotsMeta } from "./basic.js";
|
|
7
|
+
export { setHreflangTags, setFavicon, setAppleTouchIcon, setMaskIcon, setThemeColor, setViewport, } from "./advanced.js";
|
|
8
|
+
export { setOpenGraph, setTwitterCard } from "./social.js";
|
|
9
|
+
export { setPreloadHints, setPreconnectHints, setDnsPrefetchHints, } from "./performance.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/domains/seo/utils/meta-tags/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EACL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta Tags Module
|
|
3
|
+
*
|
|
4
|
+
* All meta tag related utilities
|
|
5
|
+
*/
|
|
6
|
+
export { setMetaTag, setLinkTag, setRobotsMeta } from "./basic.js";
|
|
7
|
+
export { setHreflangTags, setFavicon, setAppleTouchIcon, setMaskIcon, setThemeColor, setViewport, } from "./advanced.js";
|
|
8
|
+
export { setOpenGraph, setTwitterCard } from "./social.js";
|
|
9
|
+
export { setPreloadHints, setPreconnectHints, setDnsPrefetchHints, } from "./performance.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Hints
|
|
3
|
+
*
|
|
4
|
+
* Functions for preload, preconnect, and DNS prefetch hints
|
|
5
|
+
*/
|
|
6
|
+
import type { PreloadHint, PreconnectOrigin, DnsPrefetchDomain } from "../../types/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* Set preload hints
|
|
9
|
+
*/
|
|
10
|
+
export declare const setPreloadHints: (preloads: PreloadHint[]) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Set preconnect hints
|
|
13
|
+
*/
|
|
14
|
+
export declare const setPreconnectHints: (origins: PreconnectOrigin[]) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Set DNS prefetch hints
|
|
17
|
+
*/
|
|
18
|
+
export declare const setDnsPrefetchHints: (domains: DnsPrefetchDomain[]) => void;
|
|
19
|
+
//# sourceMappingURL=performance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../../../../src/domains/seo/utils/meta-tags/performance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG7F;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,WAAW,EAAE,SAuBtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,gBAAgB,EAAE,SAa7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB,EAAE,SAS/D,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Hints
|
|
3
|
+
*
|
|
4
|
+
* Functions for preload, preconnect, and DNS prefetch hints
|
|
5
|
+
*/
|
|
6
|
+
import { setLinkTag } from "./basic.js";
|
|
7
|
+
/**
|
|
8
|
+
* Set preload hints
|
|
9
|
+
*/
|
|
10
|
+
export const setPreloadHints = (preloads) => {
|
|
11
|
+
if (typeof document === "undefined")
|
|
12
|
+
return;
|
|
13
|
+
// Remove existing preload hints for same resources
|
|
14
|
+
preloads.forEach((preload) => {
|
|
15
|
+
const existing = document.querySelector(`link[rel="preload"][href="${preload.href}"]`);
|
|
16
|
+
if (existing)
|
|
17
|
+
existing.remove();
|
|
18
|
+
});
|
|
19
|
+
// Add preload hints
|
|
20
|
+
preloads.forEach((preload) => {
|
|
21
|
+
const attrs = {
|
|
22
|
+
rel: "preload",
|
|
23
|
+
href: preload.href,
|
|
24
|
+
as: preload.as,
|
|
25
|
+
};
|
|
26
|
+
if (preload.type)
|
|
27
|
+
attrs.type = preload.type;
|
|
28
|
+
if (preload.crossOrigin)
|
|
29
|
+
attrs.crossorigin = preload.crossOrigin;
|
|
30
|
+
if (preload.integrity)
|
|
31
|
+
attrs.integrity = preload.integrity;
|
|
32
|
+
setLinkTag(attrs);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Set preconnect hints
|
|
37
|
+
*/
|
|
38
|
+
export const setPreconnectHints = (origins) => {
|
|
39
|
+
if (typeof document === "undefined")
|
|
40
|
+
return;
|
|
41
|
+
origins.forEach((origin) => {
|
|
42
|
+
const attrs = {
|
|
43
|
+
rel: "preconnect",
|
|
44
|
+
href: origin.href,
|
|
45
|
+
};
|
|
46
|
+
if (origin.crossOrigin)
|
|
47
|
+
attrs.crossorigin = origin.crossOrigin;
|
|
48
|
+
setLinkTag(attrs);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Set DNS prefetch hints
|
|
53
|
+
*/
|
|
54
|
+
export const setDnsPrefetchHints = (domains) => {
|
|
55
|
+
if (typeof document === "undefined")
|
|
56
|
+
return;
|
|
57
|
+
domains.forEach((domain) => {
|
|
58
|
+
setLinkTag({
|
|
59
|
+
rel: "dns-prefetch",
|
|
60
|
+
href: domain.href,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Social Media Tag Operations
|
|
3
|
+
*
|
|
4
|
+
* Functions for Open Graph and Twitter Card tags
|
|
5
|
+
*/
|
|
6
|
+
import type { SEOptions } from "../../types/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* Set Open Graph tags
|
|
9
|
+
*/
|
|
10
|
+
export declare const setOpenGraph: (openGraph: SEOptions["openGraph"]) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Set Twitter Card tags
|
|
13
|
+
*/
|
|
14
|
+
export declare const setTwitterCard: (twitter: SEOptions["twitter"], __openGraphImage?: SEOptions["openGraph"]) => void;
|
|
15
|
+
//# sourceMappingURL=social.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social.d.ts","sourceRoot":"","sources":["../../../../../src/domains/seo/utils/meta-tags/social.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,WAAW,SAAS,CAAC,WAAW,CAAC,SA8E7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,SAAS,CAAC,SAAS,CAAC,EAC7B,mBAAmB,SAAS,CAAC,WAAW,CAAC,SA2C1C,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Social Media Tag Operations
|
|
3
|
+
*
|
|
4
|
+
* Functions for Open Graph and Twitter Card tags
|
|
5
|
+
*/
|
|
6
|
+
import { setMetaTag } from "./basic.js";
|
|
7
|
+
/**
|
|
8
|
+
* Set Open Graph tags
|
|
9
|
+
*/
|
|
10
|
+
export const setOpenGraph = (openGraph) => {
|
|
11
|
+
if (!openGraph)
|
|
12
|
+
return;
|
|
13
|
+
const setOG = (property, content) => {
|
|
14
|
+
if (content)
|
|
15
|
+
setMetaTag("property", `og:${property}`, content);
|
|
16
|
+
};
|
|
17
|
+
setOG("title", openGraph.title);
|
|
18
|
+
setOG("description", openGraph.description);
|
|
19
|
+
setOG("url", openGraph.url);
|
|
20
|
+
setOG("type", openGraph.type);
|
|
21
|
+
setOG("site_name", openGraph.siteName);
|
|
22
|
+
setOG("locale", openGraph.locale);
|
|
23
|
+
// Handle multiple images
|
|
24
|
+
if (openGraph.image) {
|
|
25
|
+
if (Array.isArray(openGraph.image)) {
|
|
26
|
+
openGraph.image.forEach((img, index) => {
|
|
27
|
+
const suffix = index > 0 ? `:${index}` : "";
|
|
28
|
+
setOG(`image${suffix}`, img.url);
|
|
29
|
+
if (img.secureUrl)
|
|
30
|
+
setOG(`image:secure_url${suffix}`, img.secureUrl);
|
|
31
|
+
if (img.type)
|
|
32
|
+
setOG(`image:type${suffix}`, img.type);
|
|
33
|
+
if (img.width)
|
|
34
|
+
setOG(`image:width${suffix}`, String(img.width));
|
|
35
|
+
if (img.height)
|
|
36
|
+
setOG(`image:height${suffix}`, String(img.height));
|
|
37
|
+
if (img.alt)
|
|
38
|
+
setOG(`image:alt${suffix}`, img.alt);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
setOG("image", openGraph.image);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Alternate locales
|
|
46
|
+
if (openGraph.alternateLocale) {
|
|
47
|
+
openGraph.alternateLocale.forEach((locale, index) => {
|
|
48
|
+
setMetaTag("property", `og:locale:alternate${index > 0 ? `:${index}` : ""}`, locale);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Article specific
|
|
52
|
+
if (openGraph.type === "article" && openGraph.article) {
|
|
53
|
+
setOG("article:published_time", openGraph.article.publishedTime);
|
|
54
|
+
setOG("article:modified_time", openGraph.article.modifiedTime);
|
|
55
|
+
setOG("article:expiration_time", openGraph.article.expirationTime);
|
|
56
|
+
setOG("article:author", openGraph.article.author);
|
|
57
|
+
setOG("article:section", openGraph.article.section);
|
|
58
|
+
if (openGraph.article.tag) {
|
|
59
|
+
openGraph.article.tag.forEach((tag, index) => {
|
|
60
|
+
setMetaTag("property", `og:article:tag${index > 0 ? `:${index}` : ""}`, tag);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Product specific
|
|
65
|
+
if (openGraph.type === "product" && openGraph.product) {
|
|
66
|
+
setOG("product:price:amount", String(openGraph.product.price));
|
|
67
|
+
setOG("product:price:currency", openGraph.product.priceCurrency);
|
|
68
|
+
setOG("product:availability", openGraph.product.availability);
|
|
69
|
+
setOG("product:brand", openGraph.product.brand);
|
|
70
|
+
setOG("product:sku", openGraph.product.sku);
|
|
71
|
+
setOG("product:condition", openGraph.product.condition);
|
|
72
|
+
}
|
|
73
|
+
// Profile
|
|
74
|
+
if (openGraph.type === "profile") {
|
|
75
|
+
setOG("profile:first_name", openGraph.firstName);
|
|
76
|
+
setOG("profile:last_name", openGraph.lastName);
|
|
77
|
+
setOG("profile:username", openGraph.username);
|
|
78
|
+
}
|
|
79
|
+
// Music
|
|
80
|
+
if (openGraph.type === "music" && openGraph.music) {
|
|
81
|
+
setOG("music:album", openGraph.music.album);
|
|
82
|
+
setOG("music:musician", openGraph.music.musician);
|
|
83
|
+
setOG("music:song", openGraph.music.song);
|
|
84
|
+
setOG("music:release_date", openGraph.music.releaseDate);
|
|
85
|
+
setOG("music:duration", openGraph.music.duration);
|
|
86
|
+
setOG("music:creator", openGraph.music.creator);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Set Twitter Card tags
|
|
91
|
+
*/
|
|
92
|
+
export const setTwitterCard = (twitter, __openGraphImage) => {
|
|
93
|
+
if (!twitter)
|
|
94
|
+
return;
|
|
95
|
+
const setTW = (name, content) => {
|
|
96
|
+
if (content)
|
|
97
|
+
setMetaTag("name", `twitter:${name}`, content);
|
|
98
|
+
};
|
|
99
|
+
setTW("card", twitter.cardType);
|
|
100
|
+
setTW("site", twitter.site);
|
|
101
|
+
setTW("creator", twitter.handle);
|
|
102
|
+
setTW("title", twitter.title);
|
|
103
|
+
setTW("description", twitter.description);
|
|
104
|
+
setTW("image", twitter.image);
|
|
105
|
+
setTW("image:alt", twitter.imageAlt);
|
|
106
|
+
// Player
|
|
107
|
+
if (twitter.cardType === "player") {
|
|
108
|
+
setTW("player", twitter.player);
|
|
109
|
+
setTW("player:width", twitter.playerWidth);
|
|
110
|
+
setTW("player:height", twitter.playerHeight);
|
|
111
|
+
setTW("player:stream", twitter.playerStream);
|
|
112
|
+
setTW("player:stream:content_type", twitter.playerStreamContentType);
|
|
113
|
+
}
|
|
114
|
+
// App
|
|
115
|
+
if (twitter.app) {
|
|
116
|
+
if (twitter.app.iphone) {
|
|
117
|
+
setTW("app:name:iphone", twitter.app.iphone.name);
|
|
118
|
+
setTW("app:id:iphone", twitter.app.iphone.id);
|
|
119
|
+
setTW("app:url:iphone", twitter.app.iphone.url);
|
|
120
|
+
}
|
|
121
|
+
if (twitter.app.ipad) {
|
|
122
|
+
setTW("app:name:ipad", twitter.app.ipad.name);
|
|
123
|
+
setTW("app:id:ipad", twitter.app.ipad.id);
|
|
124
|
+
setTW("app:url:ipad", twitter.app.ipad.url);
|
|
125
|
+
}
|
|
126
|
+
if (twitter.app.googleplay) {
|
|
127
|
+
setTW("app:name:googleplay", twitter.app.googleplay.name);
|
|
128
|
+
setTW("app:id:googleplay", twitter.app.googleplay.id);
|
|
129
|
+
setTW("app:url:googleplay", twitter.app.googleplay.url);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema.org Generators
|
|
3
|
+
*
|
|
4
|
+
* Helper functions to generate valid Schema.org structured data
|
|
5
|
+
*/
|
|
6
|
+
export { generateArticleSchema, generateProductSchema, generateOrganizationSchema, generateLocalBusinessSchema, generateBreadcrumbSchema, generateFAQSchema, generateWebSiteSchema, generatePersonSchema, generateVideoSchema, } from "./schema.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/domains/seo/utils/schema-generators/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema.org Generators
|
|
3
|
+
*
|
|
4
|
+
* Helper functions to generate valid Schema.org structured data
|
|
5
|
+
*/
|
|
6
|
+
export { generateArticleSchema, generateProductSchema, generateOrganizationSchema, generateLocalBusinessSchema, generateBreadcrumbSchema, generateFAQSchema, generateWebSiteSchema, generatePersonSchema, generateVideoSchema, } from "./schema.js";
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema.org JSON-LD Generators
|
|
3
|
+
*
|
|
4
|
+
* Helper functions to generate valid Schema.org structured data
|
|
5
|
+
* for various content types like articles, products, organizations, etc.
|
|
6
|
+
*/
|
|
7
|
+
import type { ArticleJsonLd, ProductJsonLd, OrganizationJsonLd, LocalBusinessJsonLd, BreadcrumbJsonLd, FAQJsonLd, WebSiteJsonLd, PersonJsonLd, VideoJsonLd, SchemaGeneratorOptions } from "../../types/schema.js";
|
|
8
|
+
export interface ArticleSchemaInput {
|
|
9
|
+
headline: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
image: string | string[];
|
|
12
|
+
datePublished: string;
|
|
13
|
+
dateModified?: string;
|
|
14
|
+
authorName: string;
|
|
15
|
+
authorUrl?: string;
|
|
16
|
+
authorType?: "Person" | "Organization";
|
|
17
|
+
publisherName: string;
|
|
18
|
+
publisherLogo: string;
|
|
19
|
+
publisherUrl?: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
articleSection?: string;
|
|
22
|
+
wordCount?: number;
|
|
23
|
+
keywords?: string | string[];
|
|
24
|
+
inLanguage?: string;
|
|
25
|
+
type?: "Article" | "NewsArticle" | "BlogPosting";
|
|
26
|
+
}
|
|
27
|
+
export declare const generateArticleSchema: (input: ArticleSchemaInput, options?: SchemaGeneratorOptions) => ArticleJsonLd;
|
|
28
|
+
export interface ProductSchemaInput {
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
image: string | string[];
|
|
32
|
+
price: number;
|
|
33
|
+
priceCurrency: string;
|
|
34
|
+
availability?: "InStock" | "OutOfStock" | "PreOrder";
|
|
35
|
+
url?: string;
|
|
36
|
+
brandName?: string;
|
|
37
|
+
sku?: string;
|
|
38
|
+
gtin?: string;
|
|
39
|
+
aggregateRating?: {
|
|
40
|
+
ratingValue: number;
|
|
41
|
+
reviewCount: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export declare const generateProductSchema: (input: ProductSchemaInput, options?: SchemaGeneratorOptions) => ProductJsonLd;
|
|
45
|
+
export interface OrganizationSchemaInput {
|
|
46
|
+
name: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
url?: string;
|
|
49
|
+
logo?: string;
|
|
50
|
+
sameAs?: string[];
|
|
51
|
+
contactPoint?: {
|
|
52
|
+
telephone: string;
|
|
53
|
+
contactType: string;
|
|
54
|
+
email?: string;
|
|
55
|
+
}[];
|
|
56
|
+
address?: {
|
|
57
|
+
streetAddress: string;
|
|
58
|
+
addressLocality: string;
|
|
59
|
+
addressRegion: string;
|
|
60
|
+
postalCode: string;
|
|
61
|
+
addressCountry: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export declare const generateOrganizationSchema: (input: OrganizationSchemaInput, options?: SchemaGeneratorOptions) => OrganizationJsonLd;
|
|
65
|
+
export interface LocalBusinessSchemaInput extends OrganizationSchemaInput {
|
|
66
|
+
address: {
|
|
67
|
+
streetAddress: string;
|
|
68
|
+
addressLocality: string;
|
|
69
|
+
addressRegion: string;
|
|
70
|
+
postalCode: string;
|
|
71
|
+
addressCountry: string;
|
|
72
|
+
};
|
|
73
|
+
geo?: {
|
|
74
|
+
latitude: number;
|
|
75
|
+
longitude: number;
|
|
76
|
+
};
|
|
77
|
+
openingHours?: {
|
|
78
|
+
dayOfWeek: string | string[];
|
|
79
|
+
opens: string;
|
|
80
|
+
closes: string;
|
|
81
|
+
}[];
|
|
82
|
+
priceRange?: string;
|
|
83
|
+
type?: "LocalBusiness" | "Restaurant" | "Store" | "Dentist" | "Hospital";
|
|
84
|
+
}
|
|
85
|
+
export declare const generateLocalBusinessSchema: (input: LocalBusinessSchemaInput, options?: SchemaGeneratorOptions) => LocalBusinessJsonLd;
|
|
86
|
+
export declare const generateBreadcrumbSchema: (items: Array<{
|
|
87
|
+
name: string;
|
|
88
|
+
item: string;
|
|
89
|
+
position?: number;
|
|
90
|
+
}>, options?: SchemaGeneratorOptions) => BreadcrumbJsonLd;
|
|
91
|
+
export interface FAQItemInput {
|
|
92
|
+
question: string;
|
|
93
|
+
answer: string;
|
|
94
|
+
}
|
|
95
|
+
export declare const generateFAQSchema: (faqs: FAQItemInput[], options?: SchemaGeneratorOptions) => FAQJsonLd;
|
|
96
|
+
export interface WebSiteSchemaInput {
|
|
97
|
+
name: string;
|
|
98
|
+
url: string;
|
|
99
|
+
description?: string;
|
|
100
|
+
searchTarget?: string;
|
|
101
|
+
searchQueryParam?: string;
|
|
102
|
+
publisher?: {
|
|
103
|
+
name: string;
|
|
104
|
+
logo?: string;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export declare const generateWebSiteSchema: (input: WebSiteSchemaInput, options?: SchemaGeneratorOptions) => WebSiteJsonLd;
|
|
108
|
+
export interface PersonSchemaInput {
|
|
109
|
+
name: string;
|
|
110
|
+
givenName?: string;
|
|
111
|
+
familyName?: string;
|
|
112
|
+
jobTitle?: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
image?: string;
|
|
115
|
+
url?: string;
|
|
116
|
+
sameAs?: string[];
|
|
117
|
+
email?: string;
|
|
118
|
+
telephone?: string;
|
|
119
|
+
worksFor?: {
|
|
120
|
+
name: string;
|
|
121
|
+
url?: string;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export declare const generatePersonSchema: (input: PersonSchemaInput, options?: SchemaGeneratorOptions) => PersonJsonLd;
|
|
125
|
+
export interface VideoSchemaInput {
|
|
126
|
+
name: string;
|
|
127
|
+
description?: string;
|
|
128
|
+
thumbnailUrl: string;
|
|
129
|
+
uploadDate: string;
|
|
130
|
+
duration?: string;
|
|
131
|
+
embedUrl?: string;
|
|
132
|
+
viewCount?: number;
|
|
133
|
+
}
|
|
134
|
+
export declare const generateVideoSchema: (input: VideoSchemaInput, options?: SchemaGeneratorOptions) => VideoJsonLd;
|
|
135
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../src/domains/seo/utils/schema-generators/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,WAAW,EACX,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AA0B/B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,QAAQ,GAAG,cAAc,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,aAAa,CAAC;CAClD;AAED,eAAO,MAAM,qBAAqB,GAChC,OAAO,kBAAkB,EACzB,UAAU,sBAAsB,KAC/B,aA2CF,CAAC;AAMF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAA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