Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function SearchResultItem({ resultItem, q }) {
const searchWords = q.split(/\s+/);
const extractedText = Scrivito.extractText(resultItem, { length: 220 });
const textToHighlight = truncate(extractedText, {
length: 200,
separator: /,? +/,
});
return (
<div>
<div>
<h3>
</h3></div></div>
function dataFromBlogPost(blogPost) {
const description = Scrivito.extractText(blogPost, { length: 330 });
return {
"@context": "http://schema.org",
"@type": "BlogPosting",
author: blogPost.get("author")
? dataFromAuthor(blogPost.get("author"))
: undefined,
datePublished: formatDate(blogPost.get("publishedAt"), "yyyy-mm-dd"),
description: truncate(description, { length: 300 }),
headline: blogPost.get("title"),
image: urlFromBinary(blogPost.get("titleImage")),
keywords: blogPost.get("tags").join(", "),
};
}
const BlogPostPreview = Scrivito.connect(({ post }) => {
return (
<li>
<div>
<div>
<h3>
{post.get("title")}
</h3>
<h4>{post.get("subtitle")}</h4>
<p>
{truncate(Scrivito.extractText(post, { length: 330 }), {
length: 300,
separator: /,? +/,
})}
</p>
</div>
<div>
Read more
<i aria-hidden="true">
</i><i aria-hidden="true">
</i></div><i aria-hidden="true">
</i></div><i aria-hidden="true">
</i></li><i aria-hidden="true">
);
});
</i>
function getMetadata(page) {
const meta = [
{ name: "twitter:card", content: "summary_large_image" },
{ name: "prerender-status-code", content: "200" },
{ property: "og:type", content: "article" },
{ property: "og:url", content: Scrivito.urlFor(page) },
];
const extractedText = Scrivito.extractText(page, { length: 330 });
const robotsIndex = page.get("robotsIndex");
if (robotsIndex === "no") {
meta.push({ name: "robots", content: "noindex" });
}
const description = page.get("metaDataDescription");
if (description) {
meta.push({ name: "description", content: description });
}
const root = Scrivito.Obj.root();
if (root) {
const facebookAppId = root.get("facebookAppId");
if (facebookAppId) {
meta.push({ property: "fb:app_id", content: facebookAppId });
function dataFromJob(job) {
return {
"@context": "http://schema.org",
"@type": "JobPosting",
title: job.get("title"),
datePosted: formatDate(job.get("datePosted"), "yyyy-mm-dd"),
validThrough: formatDate(job.get("validThrough"), "yyyy-mm-dd"),
description: Scrivito.extractText(job),
employmentType: job.get("employmentType"),
hiringOrganization: {
"@type": "Organization",
name: job.get("hiringOrganizationName"),
sameAs: job.get("hiringOrganizationWebsite"),
},
jobLocation: locationFromJob(job),
};
}