amp-story-player
說明
用於在您自己的 AMP 網站中嵌入和播放您喜愛的故事播放器。
必要指令碼
<script async custom-element="amp-story-player" src="https://cdn.ampproject.org/v0/amp-story-player-0.1.js"></script>
用法
使用 amp-story-player
在 AMP 網頁中嵌入和播放故事。
嵌入 AMP 頁面
以下程式碼片段示範在 AMP 網頁中嵌入 <amp-story-player>
。
<head> <script async src="https://cdn.ampproject.org/v0.js"></script> <script async custom-element="amp-story-player" src="https://cdn.ampproject.org/v0/amp-story-player-0.1.js" ></script> </head> <body> <amp-story-player layout="fixed" width="360" height="600"> <a href="https://preview.amp.dev/documentation/examples/introduction/stories_in_amp/"> <img src="https://amp.dev.org.tw/static/samples/img/story_dog2_portrait.jpg" width="360" height="600" loading="lazy" data-amp-story-player-poster-img> Stories in AMP - Hello World </a> </amp-story-player> </body>
指定嵌入的故事
<amp-story-player>
元件包含一個或多個 <a>
標籤。將每個標籤的 href 屬性指向故事網址。
將故事標題放在 <a>
標籤內。這能提供更佳的使用者體驗,並讓搜尋引擎能夠檢索嵌入的故事。
屬性
版面配置 (layout)
支援任何尺寸定義的版面配置
- 固定 (fixed)
- 固定高度 (fixed-height)
- 回應式 (responsive)
- 填滿 (fill)
驗證
請參閱 AMP 驗證工具規格中的 amp-story-player 規則。
需要更多協助嗎?
您已閱讀這份文件許多次,但它仍然沒有涵蓋您的所有問題嗎?也許其他人也有同樣的感覺:在 Stack Overflow 上與他們交流。
前往 Stack Overflow 發現錯誤或缺少功能?AMP 專案大力鼓勵您的參與和貢獻!我們希望您能成為我們開放原始碼社群的長期參與者,但我們也歡迎您針對您特別熱衷的問題做出一次性的貢獻。
前往 GitHub