@actinc/dls
Version:
Design Language System (DLS) for ACT & Encoura front-end projects.
41 lines • 1.82 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
export var RenderMetaTags = function (_a) {
var description = _a.description, imageUrl = _a.imageUrl, keywords = _a.keywords, noIndex = _a.noIndex, title = _a.title, Wrapper = _a.Wrapper;
var children = [];
if (description) {
// Search Engines
children.push(_jsx("meta", { content: description, name: "description" }, "description"));
// Facebook Open Graph
children.push(_jsx("meta", { content: description, property: "og:description" }, "og:description"));
// Twitter Cards
children.push(_jsx("meta", { content: description, name: "twitter:text:description" }, "twitter:text:description"));
}
if (imageUrl) {
// Facebook Open Graph
children.push(_jsx("meta", { content: imageUrl, property: "og:image" }, "og:image"));
// Twitter Cards
children.push(_jsx("meta", { content: imageUrl, name: "twitter:image" }, "twitter:image"));
}
if (keywords) {
// Search Engines
children.push(_jsx("meta", { content: keywords.toString(), name: "keywords" }, "keywords"));
}
if (title) {
// Browser Tab, Search Engines
children.push(_jsx("title", { itemProp: "name", lang: "en", children: title }, "title"));
// Facebook Open Graph
children.push(_jsx("meta", { content: title, property: "og:title" }, "og:title"));
// Twitter Cards
children.push(_jsx("meta", { content: title, name: "twitter:title" }, "twitter:title"));
}
if (noIndex) {
// Robots
children.push(_jsx("meta", { content: "noindex,follow", name: "robots" }, "robots"));
}
if (Wrapper) {
return Wrapper(children);
}
return children;
};
export default RenderMetaTags;
//# sourceMappingURL=index.js.map