我正在使用反應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文件?包含應用程序的根目錄元素的文件。 –