ag-common 0.0.448 → 0.0.450
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.
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/** full page title = title | hostname | tagline */
|
|
2
3
|
export interface IHeadersRaw {
|
|
4
|
+
/** eg https://abc.def */
|
|
5
|
+
siteUrl: string;
|
|
3
6
|
title?: string;
|
|
4
7
|
image?: string;
|
|
5
8
|
description?: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
/** eg 'a site to remember' */
|
|
10
|
+
tagline?: string;
|
|
11
|
+
/** csv or separate keyword strings */
|
|
12
|
+
keywords?: string | string[];
|
|
9
13
|
}
|
|
10
|
-
export declare const HeadersRaw: ({ title, image,
|
|
14
|
+
export declare const HeadersRaw: ({ title, image, siteUrl, tagline, keywords, }: IHeadersRaw) => React.JSX.Element[];
|
|
15
|
+
export declare const HeadersRawNext: ({ title, image, siteUrl, tagline, description, keywords, }: IHeadersRaw) => {
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
keywords: string | string[] | undefined;
|
|
19
|
+
openGraph: {
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
siteName: string;
|
|
23
|
+
url: string;
|
|
24
|
+
images: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
twitter: {
|
|
27
|
+
title: string;
|
|
28
|
+
description: string;
|
|
29
|
+
card: string;
|
|
30
|
+
images: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HeadersRaw = void 0;
|
|
6
|
+
exports.HeadersRawNext = exports.HeadersRaw = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const HeadersRaw = ({ title, image,
|
|
9
|
-
const
|
|
8
|
+
const HeadersRaw = ({ title, image, siteUrl, tagline, keywords, }) => {
|
|
9
|
+
const { origin, hostname } = new URL(siteUrl);
|
|
10
|
+
const fullTitle = [title, hostname, tagline].filter((r) => r).join(' | ');
|
|
10
11
|
const titleFallback = title || fullTitle;
|
|
11
12
|
const titleBlock = [
|
|
12
13
|
react_1.default.createElement("title", { key: "1" }, fullTitle),
|
|
@@ -27,14 +28,38 @@ const HeadersRaw = ({ title, image, SiteShort, FullSiteUrl, siteDesc, }) => {
|
|
|
27
28
|
return [
|
|
28
29
|
react_1.default.createElement("meta", { key: "11", charSet: "utf-8" }),
|
|
29
30
|
...titleBlock,
|
|
30
|
-
react_1.default.createElement("meta", { key: "12", property: "og:site_name", content:
|
|
31
|
-
react_1.default.createElement("meta", { key: "13", property: "og:url", content:
|
|
32
|
-
react_1.default.createElement("meta", { key: "14", itemProp: "url", content:
|
|
33
|
-
react_1.default.createElement("meta", { key: "15", name: "twitter:url", content:
|
|
31
|
+
react_1.default.createElement("meta", { key: "12", property: "og:site_name", content: hostname }),
|
|
32
|
+
react_1.default.createElement("meta", { key: "13", property: "og:url", content: origin }),
|
|
33
|
+
react_1.default.createElement("meta", { key: "14", itemProp: "url", content: origin }),
|
|
34
|
+
react_1.default.createElement("meta", { key: "15", name: "twitter:url", content: origin }),
|
|
34
35
|
react_1.default.createElement("meta", { key: "16", property: "og:type", content: "website" }),
|
|
35
36
|
react_1.default.createElement("meta", { key: "17", name: "twitter:card", content: "summary_large_image" }),
|
|
36
37
|
react_1.default.createElement("meta", { key: "18", name: "robots", content: "index, follow" }),
|
|
38
|
+
react_1.default.createElement("meta", { key: "19", name: "keywords", content: Array.isArray(keywords) ? keywords.join(', ') : keywords }),
|
|
37
39
|
...imagearr,
|
|
38
40
|
];
|
|
39
41
|
};
|
|
40
42
|
exports.HeadersRaw = HeadersRaw;
|
|
43
|
+
const HeadersRawNext = ({ title, image, siteUrl, tagline, description, keywords, }) => {
|
|
44
|
+
const { origin, hostname } = new URL(siteUrl);
|
|
45
|
+
const fullTitle = [title, hostname, tagline].filter((r) => r).join(' | ');
|
|
46
|
+
return {
|
|
47
|
+
title: fullTitle,
|
|
48
|
+
description: description || fullTitle,
|
|
49
|
+
keywords,
|
|
50
|
+
openGraph: {
|
|
51
|
+
title: fullTitle,
|
|
52
|
+
description: description || fullTitle,
|
|
53
|
+
siteName: hostname,
|
|
54
|
+
url: origin,
|
|
55
|
+
images: image,
|
|
56
|
+
},
|
|
57
|
+
twitter: {
|
|
58
|
+
title: fullTitle,
|
|
59
|
+
description: description || fullTitle,
|
|
60
|
+
card: 'summary_large_image',
|
|
61
|
+
images: image,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
exports.HeadersRawNext = HeadersRawNext;
|
package/package.json
CHANGED