[Gutenberg] Extend existing core blocks for AMP specific functionality
postphotos opened this issue · 10 comments
As a WordPress site running Gutenberg, my core/native blocks should have extended AMP-HTML markup features.
-
AC1: Extend core blocks which have validation errors so that the appropriate AMP markup is output to faithfully render the block when the page is served as AMP. This would be done via some combination of the render_callback that integrates with a new block sanitizer/preprocessor.
-
AC2: Further extend core blocks to leverage AMP functionality, such as layout.
See #902 (comment)
Update On Related Work
Hi @postphotos,
You probably saw @westonruter's comment above, linking to #902:
- Extend core blocks which have validation errors so that the appropriate AMP markup is output to faithfully render the block when the page is served as AMP.
In #1010, @miina is now working on a block that doesn't support AMP: 'categories' with a dropdown.
- Further extend core blocks to leverage AMP functionality, such as layout.
That would be good for this issue.
Just FI that started looking into this and will add a possible "prototype" of the approach for discussing (based on adding AMP Layout
setting) in the beginning of the new week.
Awesome. I'm looking forward to seeing that!
Created a PR with initial take on the approach: #1026. Would be great to receive some feedback before continuing.
We've talked about this before, but as part of this we'll need to make sure that any AMP components and attributes that get added to post_content
will need to get whitelisted for Kses.
Request For Testing
Hi @csossi,
Could you please test this?
- Go to https://native-ampconfdemo.pantheonsite.io/
- Create a new post
- Add an image block
- In the "Block" panel, choose a different value for "AMP Layout"
- Select "AMP lightbox effect"
- Click "Save Draft"
- Expected: those settings still display
- Click "Preview"
- Click the image
- Expected: It expands to fill the screen, in a "Lightbox Effect"
- Repeat steps 3-10, but with the "Gallery" block
verified in QA