How to use the scrivito.urlFor 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 / prerenderContent / prerenderObj.js View on Github external
const { result, preloadDump } = await Scrivito.renderPage(obj, () => {
    const bodyContent = ReactDOMServer.renderToString();
    const helmet = Helmet.renderStatic();

    return {
      objId: obj.id(),
      objUrl: Scrivito.urlFor(obj),
      htmlAttributes: helmet.htmlAttributes.toString(),
      headContent: `
          ${helmet.title.toString()}
          ${helmet.meta.toString()}
          ${helmet.link.toString()}
        `,
      bodyAttributes: helmet.bodyAttributes.toString(),
      bodyContent,
    };
  });
github Scrivito / scrivito_example_app_js / src / Components / CurrentPageMetadata.js View on Github external
const htmlAttributes = { lang: "en" };
  let title = "";
  let meta = [];
  const links = [
    {
      rel: "shortcut icon",
      type: "image/png",
      href: favicon,
    },
  ];

  const page = Scrivito.currentPage();
  if (page) {
    title = page.get("title") || "";
    meta = getMetadata(page);
    links.push({ rel: "canonical", href: Scrivito.urlFor(page) });
  }

  return (
    
  );
});
github Scrivito / scrivito_example_app_js / src / Components / CookieConsent.js View on Github external
render() {
    const root = Scrivito.Obj.root();

    if (!root) {
      return null;
    }

    const cookieConsentLink = root.get("cookieConsentLink");

    if (!cookieConsentLink) {
      return null;
    }

    const cookieConsentLinkUrl = Scrivito.urlFor(cookieConsentLink);
    const cookieLinkTitle = cookieConsentLink.title() || "Learn more »";

    return (
      
        <div></div>
github Scrivito / scrivito_example_app_js / src / utils / sitemapXml.js View on Github external
function pageToSitemapUrl(page) {
  return {
    url: [
      { loc: Scrivito.urlFor(page) },
      { lastmod: formatDate(page.lastChanged(), 'yyyy-mm-dd') },
    ],
  };
}
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");
github Scrivito / scrivito_example_app_js / src / prerenderContent / prerenderObjs.js View on Github external
asyncForEach(objsGroup, async obj => {
      try {
        const prerenderedFiles = await prerenderObj(obj);
        await asyncForEach(prerenderedFiles, storeResult);
      } catch (e) {
        failedCount += 1;
        const pageId = obj.id();
        const pageUrl = Scrivito.urlFor(obj);
        reportError(
          `Error while processing obj ${pageId} (${pageUrl}). Skipping file.`,
          e.message,
          e
        );
      }
    })
  );
github Scrivito / scrivito_example_app_js / src / Objs / Redirect / RedirectComponent.js View on Github external
Scrivito.load(() => {
      const link = this.props.page.get("link");
      const url = link && Scrivito.urlFor(link);

      return { link, url };
    }).then(({ link, url }) => {
      if (!link) {
github Scrivito / scrivito_example_app_js / src / Components / SchemaDotOrg / dataFromEvent.js View on Github external
function dataFromEvent(event) {
  return {
    "@context": "http://schema.org",
    "@type": "Event",
    name: event.get("title"),
    url: Scrivito.urlFor(event),
    startDate: formatDate(event.get("date"), "yyyy-mm-dd"),
    location: locationFromEvent(event),
    image: urlFromBinary(event.get("image")),
    description: event.get("metaDataDescription"),
  };
}
github Scrivito / scrivito_example_app_js / src / sitemap.js View on Github external
function pageToSitemapUrl(page) {
  return {
    url: [
      { loc: Scrivito.urlFor(page) },
      { lastmod: formatDate(page.lastChanged(), "yyyy-mm-dd") },
    ],
  };
}
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 textExtract = textExtractFromObj(page);

  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");

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 12 days ago

Package Health Score

68 / 100
Full package analysis