MOPCON
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 想在 AMP 網頁上做華麗麗效果的我是否搞錯了什麼 - Meng-Ying Tsai {%hackmd rG6pzIawQKe5cHU4rycgYg %} [課程簡報](http://slides.com/meng-yingtsai/amp-mopcon-2020) ## Preface 起因:Why AMP(Accelerated Mobile Pages)? 做個網站,什麼都好但就是沒有流量 嘗試來做全站 AMP 化 ### 超快速的網頁效能 Bing/Google 會幫你 Serve cache 頁面! ### 為什麼大家不來做呢? - 框架限制大、導入成本高 - 使用者有很好體驗,但開發者經驗很糟 ### 為什麼 AMP 比較快? 在 Critical Rendering Path上做各種優化 ~~限制東限制西~~ ## 來個空白的 AMP ```htmlembedded= <!doctype html> <html amp lang="en"> <head> <meta charset="utf-8"> <script async src="https://cdn.ampproject.org/v0.js"></script> <title>My first AMP Page</title> <link rel="canonical" href="https://your.site/path"> <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebPage", "name": "My first AMP Page", "description": "Put some description of the page here" } </script> <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> </head> <body> <h1>My first AMP Page</h1> <p>Some content here!</p> </body> </html> ``` canonical 要做好 ```htmlembedded= <link rel="canonical" href="https://your.site/path"> <!--structure data--> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebPage", "name": "My first AMP Page", "description": "Put some description of the page here" } </script> ``` ### 如何確定我的 AMP 沒有問題? - 使用 validation 工具 - Browser Developer Console - Browser Extension - VS Code extension https://amp.dev/#development=1 https://妳得網址/#development=1 1. 常見 Layouts - fixed - intrinsic - responsive - [Layout規範](https://amp.dev/documentation/guides-and-tutorials/learn/amp-html-layout/layouts_demonstrated/) 2. ~~USE MSG~~ 改成 amp-img - AMP 不能使用 important!!!(直接避免Layout 被破壞XD - AMP 不允許外部 CSS(除 fontaswome google font) - 只允許一個 < style > tag 和 Inline CSS 3. 來點JavaScript? - AMP 不允許你隨心所欲地放自己的 Script - JS 必須改用 AMP 元件取代 - 2019 年推出的 amp-script 還是勉勉強強可以寫 script - 例:廣告 amp-ad、圖片輪播 amp-carousel - 用你想要操作的 DOM 加上 id - amp-bind - 先把對應 scr 放進來 - 透過改變 state 來製造充滿 interaction 的 AMP 網頁 - amp-form - form 有奇妙的 attr:action-xhr - 可以送 AJAX 的需求 - amp-list - 保證網頁資訊最新(更新 cache) - 如果沒有 amp-list 的話可能會因為他 click 下後商品就被下架了QAQ!~~商家會遇到大 麻 煩~~ [name=講者] - 記得先 require 對應的 script - src 指定從哪裡 fetch json 會把 template 裡的內容根據給的資料 render 出來 - 可參考 amp-mustache 語法大全 ### 沒有辦法用 amp-bind 及 amp-list 要怎麼辦 例如:localStorage * amp-consent (小視窗) * amp-user-notification * amp-script - 透過允許部分 JS 豐富 amp 畫面 - 不超過 150 KB - Inline script + hash(content) ### 第三方 plugin 舉例 1. amp-iframe - amp-facebook - amp-Instagram - amp-Twitter 2. amp-bind-macro 神奇小工具 - JSON 資料有限制 ## 優點 VS 缺點 優點: <!--聰明鯊鯊表示 ... -->?????Vtuber鯊鯊:A~ 缺點:開發體驗糟(難客製化、難維護) ## AMP 未來? Bento AMP 漸進式要推我們入坑 # 聊天區 >如果覺得聲音太小聲,可以在這裡跟我們反應喔~ > [name=Mopcon 工人] > 帶酒是為了避免睡覺 > 標題是想要去地下城探險嗎?XDDDDD > HaiYaaaaaaa! > 需要貓貓 amp-cat > 講者還是別喝酒上場好了,這語速有點快XDDDD > 需要簡報輔助XD > R2會眾跑來湊熱鬧,R3講者喝酒上場? > 我覺得有在寫前端/程式的大神語速都很快 > 突然覺得介紹到現在講者是在反推amp XDDDDD > (Q´ェ`Q)<窩不知道 > 暨愛之則反之,我用amp所以我返amp > 講者怎麼開了一大堆分頁..... > ![](https://i.imgur.com/s5nv5U6.jpg) > 記憶體開始Haiyaaaaa > ↑蘋果會發光的MacBook很少見惹 > 講者真嗨XD嗑了什麼 > 以下開放提供講者解酒液 > 吼!偷要人ig!被抓到了吼! > 抓到了!!! > 需要IG網址,為了研究用途 > 為了介紹解酒液 ###### tags: `MOPCON 2020`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully