在 Blogger 中,我使我的网站得到支持,为此,在我的帖子中,我更改了所有 <img to <amp-img
.
但在结构化数据中,我使用以下代码:
<div class='none' itemprop='image' itemscope='itemscope' itemtype='https://schema.org/ImageObject'>
<b:if cond='data:post.firstImageUrl'>
<amp-img expr:src='data:post.firstImageUrl' itemprop='image'/>
<meta expr:content='data:post.firstImageUrl' itemprop='url'/>
</b:if>
<meta content='800' itemprop='width'/> <!--Images should be at least 696 pixels wide.-->
<meta content='800' itemprop='height'/>
</div>
<amp-img
URL,因为它用于提取 <img
仅限网址。
我该如何解决这个问题?
最佳答案
在许多论坛上进行大量搜索后,我找到了我的问题的解决方案。在后期使用中 <amp-img
来自 amp guideline 的 NoScript .
<amp-img src="images/sunset.jpg"
width="264"
height="195">
<noscript>
<img src="images/sunset.jpg" width="264" height="195" />
</noscript>
</amp-img>
这可以是您图像的两个版本,一个是放大器,另一个是非放大器。
关于javascript - 获取 AMP 图片 url 的条件标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45429717/