2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

react-helmetでheadにインラインJavascriptを記述したい時のメモ

Posted at

ほぼ、以下のコピペ。
React Helmet - Reference Guide

Javascriptの埋め込みは以下の通り。

<Helmet>
    <script type="application/javascript">{`
        {
            console.log("success!!");
        }
    `}</script>
</Helmet>

noscriptとかcss、構造化データも同様に埋め込み可。

<Helmet>
    <noscript>{`
        <link rel="stylesheet" type="text/css" href="foo.css" />
    `}</noscript>
</Helmet>
<Helmet>
    <style type="text/css">{`
        body {
            background-color: blue;
        }

        p {
            font-size: 12px;
        }
    `}</style>
</Helmet>
<Helmet>
    <script type="application/ld+json">{`
        {
            "@context": "http://schema.org"
        }
    `}</script>
</Helmet>
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?