How to use the scrivito.extractText function in scrivito

To help you get started, we’ve selected a few scrivito examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Scrivito / scrivito_example_app_js / src / Objs / SearchResults / SearchResultItem.js View on Github external
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>
github Scrivito / scrivito_example_app_js / src / Components / SchemaDotOrg / dataFromBlogPost.js View on Github external
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(", "),
  };
}
github Scrivito / scrivito_example_app_js / src / Components / BlogPost / BlogPostPreviewList.js View on Github external
const BlogPostPreview = Scrivito.connect(({ post }) =&gt; {
  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>
github Scrivito / scrivito_example_app_js / src / utils / getMetadata.js View on Github external
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 });
github Scrivito / scrivito_example_app_js / src / Components / SchemaDotOrg / dataFromJob.js View on Github external
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),
  };
}

scrivito

Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.

LGPL-3.0
Latest version published 7 days ago

Package Health Score

68 / 100
Full package analysis