Git Product home page Git Product logo

react-helmet-with-visor's Introduction

React Helmet With Visor

Fork of the famous react-helmet v5 library with the goal to inject SEO-like scripts at runtime. For main documentation, please refer to original repository (https://github.com/nfl/react-helmet). One of the possible issues it can solve: nfl#323 . The plans are marge it back to react-helmet repository as soon as possible, if they would like to accept our PR. Unfortanat

Unfortunately, for technical reasons, HelmetsOpenedVisor doesn't support toComponent functionality and no full support for PhantomJS browser.

Example

import React from "react";
import {Helmet} from "react-helmet";

class Application extends React.Component {
  render () {
    return (
        <div className="application">
            <Helmet>
                <meta charSet="utf-8" />
                <title>My Title</title>
                <link rel="canonical" href="http://mysite.com/example" />
                <HelmetsOpenedVisor>
                {`<script>
                        !function (f, b, e, v, n, t, s) {
                            if (f.fbq) return; n = f.fbq = function () {
                                n.callMethod ?
                                    n.callMethod.apply(n, arguments) : n.queue.push(arguments)
                            };
                            if (!f._fbq) f._fbq = n; n.push = n; n.loaded = !0; n.version = \'2.0\';
                            n.queue = []; t = b.createElement(e); t.async = !0;
                            t.src = v; s = b.getElementsByTagName(e)[0];
                            s.parentNode.insertBefore(t, s)
                        }(window, document, \'script\',
                            \'https://connect.facebook.net/en_US/fbevents.js\');
                        fbq(\'init\', \'*************\');
                        fbq(\'track\', \'PageView\');
                    </script><noscript>
                            &lt;img height="1" width="1" style="display:none"
                                    src="https://www.facebook.com/tr?id=************&amp;ev=PageView&amp;noscript=1"/&gt;
                    </noscript>`}
                </HelmetsOpenedVisor>
            </Helmet>
            ...
        </div>
    );
  }
};

As string output

const html = `
    <!doctype html>
    <html ${helmet.htmlAttributes.toString()}>
        <head>
            ${helmet.title.toString()}
            ${helmet.meta.toString()}
            ${helmet.link.toString()}
            ${helmet.openedVisor.toString()}
        </head>
        <body ${helmet.bodyAttributes.toString()}>
            <div id="content">
                // React stuff here
            </div>
        </body>
    </html>
`;

react-helmet-with-visor's People

Contributors

cwelch5 avatar doctyper avatar dhoward avatar potench avatar nuc avatar cesarandreu avatar andykenward avatar athomann avatar katt avatar gaearon avatar lourd avatar neilius avatar kokushkin avatar tmbtech avatar romanonthego avatar artazor avatar kulakowka avatar bryanrsmith avatar dattran92 avatar mull avatar felixsanz avatar hiroshi-cl avatar jaysoo avatar jmurzy avatar jirutka avatar jamsea avatar jasonblanchard avatar volune avatar kaseyjcowley avatar kesava avatar

Stargazers

Łukasz Wójcik avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.