“您的附加链接搜索框模板中存在错误:INVALID_SYNTAX”

时间:2019-06-27 16:53:31

标签: schema.org google-sitelink-searchbox

我的网站的所有页面上都发生以下错误:

  

inner class RemoveTagSpan : ReplacementSpan() { private val regexEndTag = Regex("</m>") override fun draw(canvas: Canvas, text: CharSequence?, start: Int, end: Int, x: Float, top: Int, y: Int, bottom: Int, paint: Paint) { text?.replace(regexEndTag, "")?.let { canvas.drawText(it, start, it.length - 1, x, y.toFloat(), paint) } } override fun getSize(paint: Paint, text: CharSequence?, start: Int, end: Int, fm: FontMetricsInt?): Int { return text?.replace(regexEndTag, "")?.let { paint.measureText(it).roundToInt() } ?: 0 } } (您的附加链接搜索框模板中存在错误:INVALID_SYNTAX。)

错误发生在第9行:

https://www.newworldproductions.net/{search_term_string}Video, Production, Services, Marketing, Minneapolis, Minnesota, Corporate Videos, Commercial Videos

1 个答案:

答案 0 :(得分:1)

似乎target的实现错误,如this article所述。无需在字符串中列出所需的搜索词,而且您甚至都不会在当前代码中寻找查询。尝试实现以下内容:

<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "https://www.newworldproductions.net/",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "https://query.newworldproductions.net/search?q={search_term_string}",
     "query-input": "required name=search_term_string"
   }
}
</script>

此外,请记住,并非每个网站都符合searchAction模式。如果他们这样做了,那么每个人都会这样做。有一些准则,在链接的文章中有涉及。您可能需要进行更多研究。