我正在创建一个由Wordpress支持的Nuxt应用程序。
我通过模式plugin.Like在我的WP REST API中接收JSON-LD,
{
wp_post_schema: "{"@context":"https://schema.org"}"
}下面是我如何在NUXT中使用它
head(){
return {
title: 'This is my page title',
meta: [
{ hid: 'description', name: 'description', content: 'This is my description' }
],
script: [
{
json: this.POST.wp_post_schema
type: 'application/ld+json'
}
],
}
},
async asyncData({ $axios, req, params, query, error, route }) {
var POST;
try {
let response = await $axios.get( "https://www.example.com/api);
return {
POST: response.data[0].post_meta_fields
};
}
}我的问题是页面上呈现的JSON-LD是经过杀毒的,google标记工具无法识别它。对如何有效地实现模式标记有什么建议吗?
发布于 2020-05-18 16:28:19
您应该使用v-html来显示更多的内容。
<template>
<script v-html="POST", type="application/ld+json">
</template>https://stackoverflow.com/questions/61865359
复制相似问题