[英]AMP: The tag 'amp-social-share' may not appear as a descendant of tag 'amp-sidebar'. Why?
AMP validator shows me the following error: AMP验证器显示以下错误:
The tag 'amp-social-share' may not appear as a descendant of tag 'amp-sidebar'. 标签'amp-social-share'可能不会显示为标签'amp-sidebar'的后代。
Honestly I do not understand a reason for such restriction. 老实说,我不明白这种限制的原因。 For example I want to show narrow sidebar on right when user clicks on the "share" icon; 例如,当用户点击“分享”图标时,我想在右边显示窄边栏; and the sidebar should have several amp-social-share items. 侧边栏应该有几个amp-social-share项目。
Why I can't do it? 为什么我不能这样做?
UPDATE UPDATE
AMP project team decided to remove this restriction. AMP项目团队决定取消此限制。 Details here: https://github.com/ampproject/amphtml/issues/4273 详情请访问: https : //github.com/ampproject/amphtml/issues/4273
It is stated in this documentation that the amp-sidebar
may not contain any AMP Elements except for amp-accordion
, amp-img
and amp-fit-text
. 本文档中指出, 除了amp-accordion
, amp-img
和amp-fit-text
之外, amp-sidebar
可能不包含任何AMP元素 。 So that is the reason you get this error because you put amp-social-share
under the amp-sidebar. 所以这就是你得到这个错误的原因,因为你把amp-social-share
放在了amp-sidebar下面。
Also take note that there can be only one amp-sidebar
in an AMP document. 另请注意,AMP文档中只能有一个amp-sidebar
。 The amp-sidebar
should be a direct child of the <body>
. amp-sidebar
应该是<body>
的直接子<body>
。 It must have a layout of no display. 它必须具有无显示的布局。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.