How to use the react-helmet.default function in react-helmet

To help you get started, we’ve selected a few react-helmet 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 LLK / scratch-www / src / views / preview / meta.jsx View on Github external
const React = require('react');
const Helmet = require('react-helmet').default;

const projectShape = require('./projectshape.jsx').projectShape;

const Meta = props => {
    const {title, instructions, author} = props.projectInfo;

    // Do not want to render any meta tags unless all the info is loaded
    // Check only author (object) because it is ok to have empty string instructions
    if (!author) return null;

    const truncatedInstructions = instructions.split(' ')
        .slice(0, 50)
        .join(' ');

    return (
github arnoldczhang / fe-guide / src / koa / example / koa-ssr / src / server.js View on Github external
router.get("/*", (ctx, next) => {
  const context = {};
  const { req } = ctx;
  const store = store_1.default();
  try {
    store.dispatch(store_1.initializeSession());
    const reactDom = render_dom_1.default(context, req, store);
    const reduxState = store.getState();
    const helmetData = react_helmet_1.default.renderStatic();
    ctx.status = 200;
    ctx.set("Content-Type", "text/html");
    ctx.body = utils_1.htmlTemplate(reactDom, reduxState, helmetData);
  } catch (err) {
    console.log(err);
    next();
  }
});
app
github datocms / gatsby-source-datocms / src / index.js View on Github external
const React = require('react');
const Helmet = require('react-helmet').default;
const objectEntries = require('object.entries');
const objectAssign = require('object-assign');

const HelmetDatoCms = ({ seo, favicon, children, ...rest }) => {
  return React.createElement(
    Helmet,
    rest,
    (seo ? seo.tags : [])
      .concat(favicon ? favicon.tags : [])
      .map((item, i) =>
        React.createElement(
          item.tagName,
          objectAssign(
            { key: `helmet-datocms-${i}` },
            objectEntries(item.attributes || {}).reduce(
              (acc, [name, value]) => {
github LLK / scratch-www / src / components / not-available / not-available.jsx View on Github external
const React = require('react');
const Helmet = require('react-helmet').default;
const FormattedMessage = require('react-intl').FormattedMessage;
const FlexRow = require('../../components/flex-row/flex-row.jsx');

require('./not-available.scss');

const ProjectNotAvailable = () => (
    
        
            <title>Scratch - Imagine, Program, Share</title>
        
        <div>
            
                <img src="/images/404-giga.png"></div>
github patternplate / patternplate / components / legacy / src / cover / index.js View on Github external
const Helmet = require("react-helmet").default;
const React = require("react");
const styled = require("styled-components").default;
const createGlobalStyle = require("styled-components").createGlobalStyle;
const ThemeProvider = require("styled-components").ThemeProvider;
const getThemes = require("@patternplate/component-themes").getThemes;

const Favicon = require("./favicon");
const Components = require("../");

module.exports.default = Cover;
module.exports.head = () => {
  const head = Helmet.renderStatic();
  return [
    head.title.toString(),
    head.meta.toString(),
    head.link.toString(),
github arnoldczhang / fe-guide / src / koa / example / koa-ssr / src / components / Contact.js View on Github external
const Contact = () =>
  React.createElement(
    "div",
    null,
    React.createElement("h2", null, "This is the contact page"),
    React.createElement(
      react_helmet_1.default,
      null,
      React.createElement("title", null, "Contact Page"),
      React.createElement("meta", {
        name: "description",
        content: "This is a proof of concept for React SSR"
      })
    )
  );
exports.default = Contact;
github fiatjaf / sitio / static.js View on Github external
var React = require('react')
var renderToString = require('react-dom/server').renderToString
var Helmet = require('react-helmet').default
var e = React.createElement

var Main = function ReactSiteMain (props) {
  var Body = require(process.env.BODY)
  var makeHelmet = require(process.env.HELMET)

  return e(Body, props,
    e(makeHelmet, props),
    e(props.page, props)
  )
}

var output = renderToString(e(Main, {
  page: require(process.env.STANDALONE),
  meta: require(process.env.STANDALONE).meta,
  pages: JSON.parse(process.env.ALLPAGESMETA),
github velop-io / server / examples / 8-react-custom-html / server.js View on Github external
route.setHTML(({ element, clientStats, relayPayload }) =&gt; {
  const ReactDOM = require("react-dom/server");
  const Helmet = require("react-helmet").default;
  const flushChunks = require("webpack-flush-chunks").flushChunks;
  const flushChunkNames = require("react-universal-component/server")
    .flushChunkNames;
  const app = ReactDOM.renderToString(element);

  const { js, styles, cssHash } = flushChunks(clientStats, {
    chunkNames: flushChunkNames()
  });

  const helmet = Helmet.renderStatic();
  let title = helmet &amp;&amp; helmet.title &amp;&amp; helmet.title.toString();
  let meta = helmet &amp;&amp; helmet.meta &amp;&amp; helmet.meta.toString();

  return `