How to use react-meta-tags - 4 common examples

To help you get started, we’ve selected a few react-meta-tags 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 54sword / react-starter / src / server / server.js View on Github external
// console.log(_route.component);
  // console.log(_route.component.loadData);

  if (_route.loadData) {
    context = await _route.loadData({ store, match: _match })
    // console.log(context);
  }

  await _route.component.preload()

  // await Loadable.preloadAll();

  // 获取路由dom
  const _Router = router.dom
  const metaTagsInstance = MetaTagsServer()

  let _mainContent = (
    
      
        
          <_Router />
        
      
    
  )

  // html
  let html = ReactDOMServer.renderToString(_mainContent)

  // 获取页面的meta,嵌套到模版中
  let meta = metaTagsInstance.renderToString()
github 54sword / xiaoduyu.com / src / server / render.tsx View on Github external
const Page: any = router.dom;
    
    let _p = await route.body.preload();

    if (_p.default.loadDataOnServer) {
      let { code, redirect } = await _p.default.loadDataOnServer({
        store, match, res, req, user
      });
      params.code = code;
      params.redirect = redirect;
    }

    // console.log(_p);
    // context={params.context}
    
    let metaTagsInstance = MetaTagsServer();    

    // html
    params.html = ReactDOMServer.renderToString(
      
        
          
        
      
    );
    
    // 获取页面的meta,嵌套到模版中
    params.meta = metaTagsInstance.renderToString();
    
    // redux
    params.reduxState = JSON.stringify(store.getState()).replace(/
github dxhuii / react-5ddm / src / server / render.js View on Github external
return
    } else if (route.enter == 'member' && !user) {
      // 注册会员
      params.context = { code: 403, redirect: '/' }
      resolve(params)
      return
    }

    if (route.loadData) {
      // 服务端加载数据,并返回页面的状态
      params.context = await route.loadData({ store, match, res, req, user })
    }

    // 获取路由dom
    const Router = router.dom
    const metaTagsInstance = MetaTagsServer()

    await route.component.preload()

    // html
    params.html = ReactDOMServer.renderToString(
      
        
          
            
          
        
      
    )

    // 获取页面的meta,嵌套到模版中
    params.meta = metaTagsInstance.renderToString()
github AlexSergey / rocket-next / src / server.jsx View on Github external
router.get('/*', async ctx => {
    const stream = new Readable();
    const metaTagsInstance = MetaTagsServer();
    const context = {};
    const history = createMemoryHistory();
    const store = createStore(history);
    const css = new Set();
    const insertCss = (...styles) => styles.forEach(style => css.add(style._getCss()));

    const jsx = webExtractor.collectChunks(
        
            
                
                    
                
            
        
    );

react-meta-tags

Handle document meta/head tags in isomorphic react with ease.

MIT
Latest version published 4 years ago

Package Health Score

50 / 100
Full package analysis

Popular react-meta-tags functions