AMP. AMP-list в Rails. Не подгружается данные в Goggle AMP
Всем привет. Я уже почти все перерыл, но найти как это решить в рейсах не мог. Дело какое, нужно отправлять письма клиентам с динамическим контентом. Шаблон сделал, проверил, рабочий. Использую amp-list. Создал енд-поинт для вытягивания данных.На офф сайте AMP все работает, но в AMP Google данные по удаленной ссылке не проходят. Думал это форма глючит. Отправил письмо себе. На почте пустой экран.
Да, для amp-list нужен Cors.
добавил гем gem 'rack-cors'
в настройках config/application.rb
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/api/v1/offer', headers: :any, methods: %i[get]
end
end
app/controllers/api/v1/offer_controller.rb
module Api
module V1
class OfferController < ActionController::API
def index
country = params[:country].to_i if params && params[:country]
region = params[:region].to_i if params && params[:region]
if !country || !region
render json: { items: [] }.to_json, status: :ok
return
end
tour = Tour.where(country: country, region: region).order(:position)
@actual = tour.where(star: true)
response.set_header('Access-Control-Allow-Credentials', 'true')
render 'api/offer/index', content_type: :'application/json'
end
end
end
end
AMP содержание (максим. урезано для упрощение)
<!doctype html>
<html ⚡4email data-css-strict>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
<script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-0.1.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-selector" src="https://cdn.ampproject.org/v0/amp-selector-0.1.js"></script>
<style amp4email-boilerplate>
body {
visibility: hidden
}
</style>
<style amp-custom>
</style>
</head>
<body>
<amp-list id="amp-list-placeholder" noloading width="auto" height="365" layout="fixed-height"
src="https://joinupdev.shm.best/api/v1/offer?country=1®ion=2">
<template type="amp-mustache">
<amp-img src="{{img1}}" width="450" height="300" layout="responsive" alt="{{name1}}"></amp-img>
</template>
</amp-list>
</body>
</html>
что я еще не дописал к заголовкам чтобы aml-list на google начал работать?