我正在使用反应Js,并且我想在我的网站中为SEO目的插入脚本标记。请参考下面的代码和成就的可能性:使用反应插入脚本标记,脚本不包含javascript代码
custom Script
<script type='application/ld+json'>
{
"@context": "http://www.sample.org",
"@type": "sampleBusiness",
"name": "test",
"url": "https://www.example.in",
"logo": "https://www.example.in/img/logo1.png",
"image": "https://www.example.in/img/logo1.png",
"description": "This is for test purpose only and shall not be used elsewhere!",
"address": {
"@type": "sampleAddress",
"streetAddress": "John Doe, #27, common street, developer house",
"addressLocality": "Test/Development",
"addressRegion": "TestRegion",
"postalCode": "testData",
"addressCountry": "DeveloperContry"
},
"email": "hop(at)example.in",
"telephone": "someexample"
}
</script>
我想是这样的补充,但它不会工作:
render : function() {
return (
<script>
{{
"@context": "http://www.sample.org",
"@type": "sampleBusiness",
"name": "test",
"url": "https://www.example.in",
"logo": "https://www.example.in/img/logo1.png",
"image": "https://www.example.in/img/logo1.png",
"description": "This is for test purpose only and shall not be used elsewhere!",
"address": {
"@type": "sampleAddress",
"streetAddress": "John Doe, #27, common street, developer house",
"addressLocality": "Test/Development",
"addressRegion": "TestRegion",
"postalCode": "testData",
"addressCountry": "DeveloperContry"
},
"email": "hop(at)example.in",
"telephone": "someexample"
}}
</script>
)
}
难道你不能只是把它放在你的HTML文件?包含应用程序的根目录元素的文件。 –