ampproject / ampproject/amphtml

SDTT errors on template[type=amp-mustache]

Open
#23,672 21 comments 0 reactions 0 assignees View on GitHub
Category: AMP in Google Search Stale Type: Bug
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

Google Structured Data Testing (`GSDTT`) validates `JSON-LD` and is a proxy for Google Knowledge Graph. Our goal is to inject an AMP document with `JSON-LD` using `amp-list` and `amp-mustache`.

Here is sample `JSON-LD`:
```
{
"@context": "http://schema.org",
"@type": "WebSite",
"@id": "#website",
"url": "https://afdsi.org/",
"name": "Structured Data Provider",
"potentialAction": {
"@type": "SearchAction",
"target": "https://afdsi.org/?s={search_term_string}",
"query-input": "required name=search_term_string"
}
}
```
And as a string:
```
{"@context":"http://schema.org","@type":"WebSite","@id":"#website","url":"https://afdsi.org/","name":"Structured Data Provider","potentialAction":{"@type":"SearchAction","target":"https://afdsi.org/?s={search_term_string}","query-input":"required name=search_term_string"}}
```
`JSON-LD` string is valid on `GSDTT`

Our conventional technique uses `jQuery`. Here is a working example in a non-AMP page:
https://afdsi.org/index.html
Click link to Google's `Structured Data Testing Tool`. See results on lower left.

Our first `amp-list` step is to transform `JSON-LD` into `amp-list` format (verified to be valid `JSON`)
```
{"items":[
{"link":"{\"@context\":\"http://schema.org\",\"@type\":\"WebSite\",\"@id\":\"#website\",\"url\":\"https://afdsi.org/\",\"name:Structured Data Provider\",\"potentialAction\":{\"@type\":\"SearchAction\",\"target\":\"https://afdsi.org/?s=?{search_term_string}\"}}"}
]}
```
Example is rendered here:
https://afdsi.org/amp-list-03/
Page is valid AMP.
When rendered on GSDTT:
https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fafdsi.org%2Famp-list-03%2F
we see the following:

```
"Uncategorized error"

{{link}}

```
`{{link}}` is highlighted

For us, this is a `severity-1` issue; we have no work-around and cannot achieve the result we customarily achieve using `jQuery` in a non-AMP page.

Are we doing something wrong?
Is there a work-around that enables an AMP page, using `amp-list`, to inject `JSON-LD` and to be harvested -- as is achieved with the `jQuery` example?

Aside: Microdata or RDFa is not an acceptable work-around ;)

We see these discussions:
https://github.com/ampproject/amphtml/issues/6229#issuecomment-408954289
https://github.com/ampproject/amphtml/pull/16782

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the amp-list and amp-mustache example at afdsi.org/amp-list-03/ and compare the rendered output with the Google Structured Data Testing Tool result. Determine whether the reported script-template error is an AMP limitation or an implementation bug; done means either valid harvested JSON-LD or a documented, supported limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.