Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jordimarimon opened this issue Feb 18, 2022 · 2 comments
Open

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

jordimarimon opened this issue Feb 18, 2022 · 2 comments

Comments

@jordimarimon
Copy link

jordimarimon commented Feb 18, 2022

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:

<amp-render layout="fixed-height" height="600" src="https://jsonplaceholder.typicode.com/users">
  <template type="amp-mustache">
    {{#.}}
    <span>{{name}}</span>
    {{/.}}
  </template>
</amp-render>

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:

<script async custom-element="amp-render" src="https://cdn.ampproject.org/v0/amp-render-1.0.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>

3. Add the following code in the body tag:

<amp-render layout="fixed-height" height="600" src="https://jsonplaceholder.typicode.com/users">
  <template type="amp-mustache">
    {{#.}}
    <span>{{name}}</span>
    {{/.}}
  </template>
</amp-render>

Relevant Logs

No response

Browser(s) Affected

No response

OS(s) Affected

No response

Device(s) Affected

No response

AMP Version Affected

No response

@jordimarimon jordimarimon changed the title Can use an array directly with <amp-mustache> Can't use an array directly with <amp-mustache> Feb 18, 2022
@jaygray0919
Copy link

jaygray0919 commented Feb 19, 2022

consider using a structure like this (walking Wikidata JSON):

<amp-list
  class="m1"
  width="auto"
  height="50"
  layout="fixed-height"
  src="https://m.wikidata.org/wiki/Special:EntityData/Q35120.json"
  items="entities.Q35120.sitelinks.jawiki"
  single-item="url"
>
<template type="amp-mustache"><p>{{url}}</p></template>
<div fallback><p>Missing site-url</p></div>
</amp-list>

@stale
Copy link

stale bot commented Mar 19, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Inactive for one year or more label Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants