ampproject / ampproject/amphtml

Can't use an array directly with <amp-mustache>

Open
#37,731 2 comments 0 reactions 0 assignees View on GitHub
P3: When Possible Stale Type: Bug WG: components
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

Sorry in advance if this issue already exist.

I have been searching around and I couldn't find anything about it.

I was playing around with AMP, to see the capabilities of it and I tried the following:

```html


{{#.}}
{{name}}
{{/.}}

```

It didn't work out, as I would expect.

It seems that the dot notation can't be used with amp-mustache?

Here is a codepen where one can see that mustache does support this notation:

https://codepen.io/jordimarimon/pen/GROQpXN

### Reproduction Steps

**1.** Open the AMP playground (https://playground.amp.dev/).

**2.** Add the following scripts:

```html

```

**3.** Add the following code in the body tag:

```html


{{#.}}
{{name}}
{{/.}}

```

### Relevant Logs

_No response_

### Browser(s) Affected

_No response_

### OS(s) Affected

_No response_

### Device(s) Affected

_No response_

### AMP Version Affected

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied amp-render and amp-mustache example in the AMP playground, using the JSONPlaceholder users response. Read the amp-render and amp-mustache implementation and existing tests to determine how a root array is handled. Done means the reported array template behavior is fixed and covered by a regression test, or the supported behavior is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.